rendering HTML stored in DB |
[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><?=$embed_html?></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><?php echo '<object>blah</object>';?></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?
[eluser]Krzemo[/eluser]
Thats weird... First I would get firebug and check headers if content type is text/html
[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 |
Welcome Guest, Not a member yet? Register Sign In |