Path

ez.no / ezpublish / documentation / reference / xml tags


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/italic text

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/thick text

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>

Unformatted text

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.

Lists

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.

Ordered lists

<ol [class="test"]>

   <li>List element 1</li>

   <li>List element 2</li>

   <li>List element 3</li>

</ol>

Unordered lists

<ul [class="test"]>

   <li>List element 1</li>

   <li>List element 2</li>

   <li>List element 3</li>

</ul>

Headings

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

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>

Anchors

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

Tables

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

Table rows can be defied just like in HTML:

<tr> Table row content goes here. </tr>

Table headers

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

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.

Objects

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.

Custom tags

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

it's not allowed to nest a link in a header, or a header in a link. is there any way to change that behaviour ?

Factbox

The syntax to make a factbox is :

<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

eZ publish 3.5 allows nested lists.

Why No Nested Lists?

What is the reason for not allowing nested lists? This breaks the outlining feature that outlines are often used for. HTML handles it. What is EZ's problem?

Doubts about Links

You write:

"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

that is not a "silly" question: it is a question about something that does not work correctly in ezpublish.

the problem with the anchor is explained in this post : http://ez.no/community/forum/setup_design/anchor_tag

silly question---anchor in eZ

I'd like to create a FAQ.

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



<a href="#test">What is your organization's name?</a>



sends the browser to www.mysite.com/path/index.php/news/news/#test

any suggestions?

Hyperlinks don't work

None of the hyperlink tags seem to work for me. Could you give a more concrete example? When I use a URL, eg. <link href='projects/project_dost'>Project DOST</link>, it comes up with an error in the debug.
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

Contents

Reference

Database diagram
Template operators
Template functions
Data fetching
Modules
XML tags


Created

18/03/2004
2:29:13 pm
by Balazs Halasy

Last updated

16/08/2006
11:55:45 am
by Svitlana Shatokhina

Authors

Balazs Halasy
Ole Morten Halvorsen
Frederik Holljen
Luc Chase
Svitlana Shatokhina



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