Welcome Guest, Not a member yet? Register   Sign In
rendering HTML stored in DB
#1

[eluser]bikuta[/eluser]
Hi,

I've got some HTML stored in the DB, e.g:

Code:
<object> blah </object>

My model retrieves the record and stores this value in a variable which is passed to the view.
This is so that the view can render this HTML as part of the output, e.g.,

Code:
<div>&lt;?=$embed_html?&gt;</div>

When I view the page, it shows the HTML as plain text, it doesn't render it as expected. However when I do this:

Code:
<div>&lt;?php echo '&lt;object&gt;blah&lt;/object&gt;';?&gt;</div>

so echo'ing the HTML stored in the DB works fine, but it doesn't work when it's passed through from the controller.
How do I make it so that the value passed from the controller gets rendered correctly?
#2

[eluser]Krzemo[/eluser]
Thats weird...
First I would get firebug and check headers if content type is text/html
#3

[eluser]Zack Kitzmiller[/eluser]
There are a few ways to resolve this. The data is probably store in the database as HTML entities. Are you using some sort of CI input method, like $this->input, or have GLOBAL XSS FILTERING enabled?

If so, it's getting store in your DB as html entiries. You could resolve that with http://php.net/manual/en/function.html-e...decode.php




Theme © iAndrew 2016 - Forum software by © MyBB