ez.no / exponential / documentation / customization / components / datatypes / ezxmltext / custom tags
In this example the tag being added is 'mynewline'.
1. Add your file that is the same name as your tag to design/user/templates/content/datatype/view/ezxmltags
in this case lets call it mynewline.tpl.
Note 1. If the directory structure does not exist, create it.
Note 2. This assumes you have you design data under 'user' and not another name. Of course you can change this.
2. Edit mynewline.tpl and place your HTML in it.. i.e.
<br />
3. Add custom tag to content.ini.php file so it is available to the online editor, if you are using it.
[CustomTagSettings] AvailableCustomTags[]=mynewline
4. If the tag is meant to be in-line, you should also add the following to your content.ini.php:
[CustomTagSettings] IsInline[mynewline]=true
Usage:
Place the following in any XML field.
<custom name='mynewline'> </custom>
Example:
To display text in a different colour change your mynewline.tpl to
<div style="color: red">{$content}</div>
Note. If you set the color of text in your css "p" tag, the above will not work as eZ places a
<p>
after your style, thus blocking it.
and add the following to your XML field.
<custom name='mynewline'> This should be red </custom>
Of course you may want to change the name of the XML tag to something more relevant.
Update: As of version 3.2 aditional arguments to the custom tag is supported. You can e.g. use:
<custom name='mynewline' color='blue'> This should be blue </custom>
The color will then be available as a variable in the template.
NOTE: remember to clear the override cache whenever you add a new tag. This can be done with
./bin/shell/clearcache.sh --clear-all
Log in or create a user account to comment.
Comments
Custom Tags with other nested tags inside...
Randeep Walia
Tuesday 31 August 2004 9:39:01 pm
If you try to put nested tags inside of a custom tag in an XMLTextField the server will come back with the ole:
In-line tags
Alex Jones
Tuesday 17 February 2004 4:07:39 pm
more attributes
enigmista enigmista
Wednesday 16 July 2003 12:58:35 pm
Shorting custom tags down...
Valentin Svelland
Monday 14 July 2003 2:39:24 pm