ez.no / documentation / ez publish / technical manual / 5.x / templates / the template language

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

The template language

The eZ Publish template language makes it possible to extract information from the system and to solve common programmatic issues like for example conditional branching, looping, etc. All eZ Publish specific code must be placed inside a set of curly brackets, "{" and "}". A template file is a combination of HTML and eZ Publish template code. Everything that is encapsulated by curly brackets will be interpreted by the template parser when the template is processed. Everything outside the curly brackets will be ignored and thus it will be sent to the browser without any changes.

Curly bracket issues

Since curly brackets are reserved for defining blocks of eZ Publish template code, these characters can not be used directly in a template. For example, JavaScript code can not be inserted directly into a template file because it makes an extensive use of curly brackets. All non template specific code/text that uses curly brackets must be put inside a "literal" section. The contents of a literal section will be ignored by the template parser. The following example demonstrates the usage of the literal tags:

<script language="JavaScript" type="text/javascript">
        document.getElementById( 'sectionName' ).select();
        document.getElementById( 'sectionName' ).focus();

Outputting curly brackets

It is possible to output curly brackets using two template functions called "ldelim" and "rdelim" (short for left delimiter and right delimiter). The following example demonstrates the usage of these functions:

This is the left curly bracket: {ldelim} <br />
This is the right curly bracket: {rdelim} <br />

The following output will be produced:

This is the left curly bracket: {
This is the right curly bracket: }

Balazs Halasy (14/09/2010 11:25 am)

Geir Arne Waaler (28/09/2010 11:30 am)