ez.no / ezpublish / documentation / reference / xml tags
These documentation pages are no longer maintained. Please visit the new documentation site.
A content class may have an XML text field attribute. Although there are no immediate visual clues, the XML text field attribute is quite different compared to the regular text field attribute. The XML text field attribute is much more powerful. In particular, it can be used to contain formatted instead of just plain text. This means that it is possible to use a collection of predefined (and also custom) tags in order to dictate how the content within the XML text field attribute should be rendered. These tags can be input directly in edit mode.
Inputting XML tags manually might not be the best solution for everyone. This is why eZ systems has developed the "Online Editor", which is a WYSIWYG frontend for the XML field. In a nutshell, the Online Editor can be thought of as an XML editor which provides a nice frontend for people who don't wish to bother with inputting the tags manually. The current version of the OE works with 5.5 or later versions of Internet Explorer and Mozilla based browsers.
The following text sheds light on the available/standard XML tags that can be used in eZ publish.
Emphasized text can be achieved by using one of the following tags: "i", "em" or "emphasize". The example below demonstrates these tags. It is possible to use the optional "class" parameter to specify the desired class that should be used when the text inside the tag is rendered.
<i [class="test"]>Italic text.</i> <em [class="test"]>Emphasized text.</em> <emphasize [class="test"]>Emphasized text.</emphasize>
Bold text can be achieved by using one of the following tags: "b", "bold" or "strong". The example box below demonstrates these tags. It is possible to use the optional "class" parameter to specify the desired class that should be used when the text inside the tag is rendered.
<b [class="test"]>Bold text.</b> <bold [class="test"]>Bold text.</bold> <strong [class="test"]>Bold text.</strong>
The "literal" tag can be used to output unformatted text, for example program source code, HTML code, XML source, etc. Everything that is inside an a literal block will be rendered in the same way (character by character) as it was input into the XML field.
<literal [class="example"]>Unformatted text/code/HTML/XML/etc.
Please note that in the example above, the slash is in the wrong way within the tag that terminates the literal block. This was done in order to make the tag appear on the documentation page (since we're using literal tags to make code blocks). In other words, it should be terminated with a frontslash instead of a backslash.
It is possible to create lists in the same way as in HTML; that is, by making use of the "ol", "ul" and "li" tags. Nesting lists is not possible. By making use of the optional "class" parameter, it is possible to specify which CSS class that should be used when the content inside the "ol" / "ul" tags should be rendered. The following text demonstrates how to create ordered and unordered lists.
<ol [class="test"]> <li>List element 1</li> <li>List element 2</li> <li>List element 3</li> </ol>
<ul [class="test"]> <li>List element 1</li> <li>List element 2</li> <li>List element 3</li> </ul>
Headings/titles can be achieved by making use of either the "h" or the "header" tag. There are two optional parameters: level and class. The level parameter can be used to define the size/level of the heading. The class parameter can be used to specify which CSS class that should be used when the heading is rendered.
<h [level="1-6"] [class="test"]>Heading/title</h> <header [level="1-6"] [class="test"]>Heading/title</header>
Hyperlinks can be inserted by making use of the "a" or the "link" tags. The following example demonstrates these tags:
<a href="URL" [target="_self|_blank"] [ class="test"]>Link name</a> <link href="URL" [target="_self|_blank"] [class="test"]>Link name</link>
The "href" parameter is required and it must be set to a valid URL. The "target" parameter can be used to determine where the target URL should be shown (inside the existing/active browser window or within a new one/popup). The "class" parameter can be used to specify a CSS class that should be used when the link is rendered.
Every link that is used in an XML field or stored using the link datatype will automatically be put inside the "ezurl" table within the database. It is possible to make use of the internal URL list when creating links. This can be done by using "id" instead of "href" within either the "a" or the "link" tag. The ID must be a valid eZ URL ID. The following example demonstrates this technique:
<a id="id" [target="_self|_blank"] [class="test"]>Link name</a> <link id="id" [target="_self|_blank"] [class="test"]>Link name</link>
The "anchor" tag makes it possible to insert HTML anchors inside the XML field. The inserted anchors will work just like standard HTML anchors. The following example demonstrates how to insert an anchor.
<anchor name="name_of_anchor" />
The name parameter must be set to a text string that is unique within the collections of anchors (if more than one) that will exist within the page that the XML field is a part of. Anchors can be reached by appending the hash character (#) followed directly by the name of the anchor that the browser should jump/scroll to. Example: http://www.example.com/hobbies#music
It is possible to create tables in the same way as in HTML; that is, by making use of the "table", "tr" and "th" and "td" tags. Tables can be nested. The following text demonstrates the syntax for setting up a table.
<table [ class="test" ] [ border="number" ] [ width="1-100%|size (in pixels)" ]> ... </table>
The attributes 'class', 'border' and 'width' are optional. Table content should be written according to normal HTML table syntax with "tr", "th" and "td" tags. See below.
Table rows can be defied just like in HTML:
<tr> Table row content goes here. </tr>
Table headers can be defined just like in HTML:
<th [ class="test" ] [ width="number" ] [ rowspan="number" ] [ colspan="number" ]> Table column header/title text goes here. </th>
All parameters are optional. Class can be used to dictate a desired CSS class. Width can be used to set the width (either as precentage or number of pixels). Rowspan and colspan are the same as in HTML.
Table data/cell can be specified using the td tag, just like in HTML:
<td [ class="example" ] [ width="number" ] [ rowspan="number" ] [ colspan="number" ]> Table cell content goes here.
All parameters are optional. Class can be used to dictate a desired CSS class. Width can be used to set the width (either as precentage or number of pixels). Rowspan and colspan are the same as in HTML.
The "object" tag makes it possible to insert an arbitrary object that exists inside the content structure of eZ publish (given that the user who is trying to use it has the proper permissions). This is a very useful tag. For instance, it makes it possible to embed images, links, lists, etc. directly in the XML field. The following box reveals the syntax for this tag:
<object id="object_id_number" [ align="left|right|center" ] [ size="small|medium|large" ] [ class="test" ] [ view="embed|text_linked" ] [ href="destination_url" ] [ target="_self|_blank" ] />
The "id" should be an existing/valid content object id. All other attributes are optional. Attributes "href" and "target" parameters can be used to render the object as a link.
It is possible to make use of custom XML tags; like this:
<custom name="name_of_custom_tag">Content goes here...</custom>
A custom tag could either be block or inline. This should be defined inside [CustomTagSettings] in an override for the content.ini configuration file.
Comments
nesting headers and links
*- pike
Friday 27 July 2007 11:09:42 am
Factbox
Hans-Henry Jakobsen
Friday 04 February 2005 9:16:12 am
<custom name='factbox' title='title'>
This is the text in my factbox
</custom>
Info about making a factbox can be found in this forum thread :
http://ez.no/community/forum/install_configuration/factbox_in_ezp_3
Nested lists
Frederik Holljen
Friday 14 January 2005 11:58:45 am
Why No Nested Lists?
Jeffrey Dunster
Thursday 13 January 2005 5:51:36 pm
Doubts about Links
willy jansen
Wednesday 10 November 2004 5:55:16 pm
"Every link that is used in an XML field or stored using the
link datatype will automatically be put inside the "ezurl"
table within the database. It is possible to make use of
the internal URL list when creating links. This can be
done by using "id" instead of "href" within either the "a"
or the "link" tag. The ID must be a valid eZ URL ID.
The following example demonstrates this technique:"
My questions are:
- what is "the link datatype"?
- where can one see this "ezurl" table (without entering the DB)?
- where can one find the ID of this URL?
- what does "valid eZ URL ID" mean?
anchor problem
willy jansen
Wednesday 10 November 2004 5:46:10 pm
the problem with the anchor is explained in this post : http://ez.no/community/forum/setup_design/anchor_tag
silly question---anchor in eZ
Kevin Myles
Wednesday 04 August 2004 5:17:13 pm
I've been able to successfully use a full link to go to an anchor, but i'd like to just have the intial link with the href tag to directly point to the anchor, without reloading the page. However, using something like
sends the browser to www.mysite.com/path/index.php/news/news/#test
any suggestions?
Hyperlinks don't work
Kai Winnem
Thursday 29 July 2004 1:21:32 pm
When I use an ID, eg. <link ID='218'>Project DOST</link>, it doesnt accept the number...
I'm using the corporate template in 3.3. The debug output is:
Warning: eZTemplate:gt Jul 29 2004 12:21:17
Unsupported type: boolean( ), must be either array, attribute object or numerical