Path

ez.no / exponential / documentation / customization / tips & tricks / clean html tags


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

The wash operator is no longer in lib/eztemplate/classes/eztemplatewashoperator.php in version 3.2, but is now in lib/eztemplate/classes/eztemplatestringoperator.php

Contents

Customization

Access control
Exponential API Documentation
Content structure
Custom design
Components
Tips & Tricks
    Debugging templates
    Javascript in templates
    Fetching current user
    Showing related objects
    Show which templates are used
    Fetching the ID of the parent
    One Article Folder
    Creating tree menus
    How can I use my own php script insid...
    Hiding attribute content
    Splitting an article over several pages
    Accessing section id in pagelayout
    List articles in folder
    Creating nice URLs
    Alt tag on images
    Improve the pagelayout.tpl
    Clean HTML tags
    Insert javascript call inside ezpub d...
    3rd party applications
    Fetch Function examples
    Display more than 15 items on your co...
    Including PHP files in templates
    Redirecting after content publishing
    HowTo see if article has an image
    Date and Time Formats
    Forms processing example: store user...
    Adjust Timezone
    Adding a Remove Button/Image
    Find the age in years for an object
    Editing, creating and removing conten...
    Indexing binary files with IFilters o...
Troubleshooting


Created

10/06/2003
8:46:54 pm
by Xavier Dutoit

Last updated

04/07/2003
5:02:47 pm
by Bård Farstad

Authors

Xavier Dutoit
Bård Farstad



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.