Converting html into plain text - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Converting html into plain text (/showthread.php?tid=2398) |
Converting html into plain text - El Forum - 08-02-2007 [eluser]Unknown[/eluser] Is anyone there who knows a way to convert html into plain text....it could be a function or a pluggin or anything ´cause I´m supposed Converting html into plain text - El Forum - 08-02-2007 [eluser]sophistry[/eluser] you mean like PHP's htmlentities() function? it's not clear what your question is... try to be more specific about your application. Converting html into plain text - El Forum - 08-02-2007 [eluser]Unknown[/eluser] Sorry, I´m gonna try to explain myself better. In my database I have stored the text of a news but in html format, so it happens that when I show the news in the browser all the html characters are shown. So what I need is a function or something that prevents those characters to be shown, what means that I want to show the news in plain text. I hope someone understands me this time. Thanks a lot anyway. Converting html into plain text - El Forum - 08-02-2007 [eluser]Michael Wales[/eluser] strip_tags() Converting html into plain text - El Forum - 08-04-2007 [eluser]John_Betong[/eluser] Hi Nakshibil, Is_this_what_you_mean In my database I store articles similiar to the above. The article includes thumbnails and links to bigger pictures. The text is mostly hard-coded HTML. All the article information is saved to a Mysql memo field. Code: $sql = "INSERT INTO blog_article (entry_id, title, memo, author, date) VALUES(" The Html formatted text is retrieved and sent to my view using the following: Code: $article_to_display = nl2br($row->memo). Cheers, John_Betong Converting html into plain text - El Forum - 08-05-2007 [eluser]Phil Sturgeon[/eluser] I second strip_tags(), works great. Instead of converting HMTL tags to text, it just rips em out. |