Page 1 of 1
escape:html not working [SOLVED]
Posted: Thu Feb 26, 2015 12:25 pm
by thomahawk
I have the news module installed. The summary template contains this:
{$entry->summary|cms_escape:htmlall}
but that text does display <p></p> tags. Some editors somehow happen to get those in their texts, I don't know why. But i was under the impression that escape:htmlall should make them disappear. Why does this not work? Anyone out there with the same experience?
Re: escape:html not working
Posted: Thu Feb 26, 2015 12:37 pm
by velden
I think you don't want to escape but to
strip the tags
Re: escape:html not working
Posted: Thu Feb 26, 2015 12:43 pm
by thomahawk
Hello velden
Indeed! This works. Yet, It seems I don't understand what escape:htmlall is for.
Thank you,
Thom
Re: escape:html not working [SOLVED]
Posted: Thu Feb 26, 2015 12:50 pm
by velden
Escaping in html means you do NOT want special characters to be interpreted as special character but just printed like it's used in the 'source'.
E.g.: < > are characters that are NOT printed by the browser but interpreted as start and end of an tag (like <p> for starting a paragraph).
Escaping '<p>' will make sure that literal text is displayed in the browser. Probably by replacing it with '<p>'
EDIT:
cms_escape:htmlall is equivalent of
http://php.net/manual/en/function.htmlentities.php
Re: escape:html not working [SOLVED]
Posted: Thu Feb 26, 2015 12:55 pm
by Jo Morg
Just to add a bit to what velden said,
cms_escape works the same as
http://www.smarty.net/docs/en/language. ... escape.tpl except its default char-set is utf-8.
Other than that just look at the link for specifics.