escape:html not working [SOLVED]

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
thomahawk
Power Poster
Power Poster
Posts: 312
Joined: Fri Jul 25, 2008 10:13 am

escape:html not working [SOLVED]

Post 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?
Last edited by thomahawk on Thu Feb 26, 2015 12:44 pm, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: escape:html not working

Post by velden »

I think you don't want to escape but to strip the tags

Code: Select all

{$entry->summary|strip_tags}
User avatar
thomahawk
Power Poster
Power Poster
Posts: 312
Joined: Fri Jul 25, 2008 10:13 am

Re: escape:html not working

Post by thomahawk »

Hello velden

Indeed! This works. Yet, It seems I don't understand what escape:htmlall is for.

Thank you,
Thom
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: escape:html not working [SOLVED]

Post 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
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: escape:html not working [SOLVED]

Post 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.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Post Reply

Return to “Modules/Add-Ons”