rendering HTML stored in DB - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: rendering HTML stored in DB (/showthread.php?tid=25649) |
rendering HTML stored in DB - El Forum - 12-19-2009 [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? rendering HTML stored in DB - El Forum - 12-19-2009 [eluser]Krzemo[/eluser] Thats weird... First I would get firebug and check headers if content type is text/html rendering HTML stored in DB - El Forum - 12-19-2009 [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-entity-decode.php |