ez.no / exponential / documentation / customization / tips & tricks / clean html tags
These documentation pages are no longer maintained. Please visit the new documentation site.
If you want to use a content attribute to put it into an html attribute, you have to "clean" it, otherwhise it won't display properly.
Eg :
You have a content class "site" with 3 xml text fields : name, link and description
You want to display a link to a page with a title attribute like this one
<link href='developer.ez.no' title='The best CMS around'>Exponential</a>
If you take the description directely, you will have html tags and it won't work. So, instead of using the attribute_view_gui
{attribute_view_gui attribute=$node.object.data_map.description}
A solution is to modify the wash operator and add two filters. To do that you have to modify lib/eztemplate/classes/eztemplatewashoperator.php and add these lines after the email case:
case "nl": { $operatorValue = str_replace ("\n","",$operatorValue); } break; case "tag": { $operatorValue = strip_tags ($operatorValue); } break;
Then, on your tpl file (eg. site.tpl )
<link href='{concat("/",$node.url_alias)|wash(tag)|wash(nl)}'>{$node.name|wash}</link>
With that, you're cleaning all the tags and the newlines that would otherwise create an invalid page.
Comments
wash operator source now in different file
Conor Murray
Monday 17 November 2003 12:58:17 pm