Stripping HTML tags from {$entry.body}
Posted: Sun Apr 06, 2008 2:58 pm
I have been notified of a small, well, not issue but downside of the Mimbo port. In many cases, it will not validate because of the bottom right column which displays articles as teasers.
Currently, those teasers are generated this way in entries_rcol.tpl:
I wasn't aware of the fact that this obviously truncates $entry.body at character no. 400 no matter what. I.e., the template takes the entry body's HTML code and truncates it at 400 chars, including the HTML tags, which in most of the cases will result in some HTML tags not being closed which will keep the page from validating almost all the time.
I figure there is no way to control truncating the article with all tags closed, especially not with regard to the variety of code people might use in $entry.body. So I was wondering: Is there a way to strip all HTML tags from $entry.body before or after truncating it? That way, I'd get a plain text output which could be put in <p></p> ...
YL
Currently, those teasers are generated this way in entries_rcol.tpl:
Code: Select all
{$entry.body|truncate:400:" ..."}I figure there is no way to control truncating the article with all tags closed, especially not with regard to the variety of code people might use in $entry.body. So I was wondering: Is there a way to strip all HTML tags from $entry.body before or after truncating it? That way, I'd get a plain text output which could be put in <p></p> ...
YL