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.

System templates

Whenever eZ publish is requested to do something else than displaying a node (in other words the URL does not contain "/content/view" or isn't the virtual URL of a node), it will use a system template. There are two main differences between system templates and node templates:

  • System templates provide access to various variables (depending on the view that was requested). A node template only provides access to a $node variable representing the node that was requested.
  • The override rules for node templates are much more flexible than the override rules for system templates.

An eZ publish distribution provides default templates for all views. These templates are located in the "templates" directory of the standard design. A view typically uses a template that is located in a subdirectory that has the same name as the module which the view belongs to. The name of the template is usually the same as the name of the view (with a ".tpl" extension). For example, the "login" view of the "user" module is looks for a template called "login.tpl" inside a directory called "user". Another example would be the "basket" view of the "shop" module. This view looks for a template called "basket.tpl" within the "shop" directory.

Custom system templates

Although eZ publish provides all the necessary system templates (by the way of the standard design), a typical eZ publish site always makes use of customized system templates. The main reason for this is because the default templates usually need to be tailored in order to fit perfectly in with the style of a custom design. Unlike custom node templates which are mostly provided using the template override system, custom system templates are usually just modified copies of the standard templates located in the custom design. For example, a custom template for the "login" view of the "user" module in a design called "example" would be "/design/example/templates/user/login.tpl". A custom template for the "search" view of the "content" module would be "/design/example/templates/content/search.tpl".

Design combinations

As mentioned in the text above, a custom design typically contains a set of customized system templates. However, creating a custom design that provides templates for all possible scenarios would be too much / unnecessary work. This is why the standard design always should be used as the last fallback resort. The automatic fallback system makes it possible to combine several designs so that the main design (which is usually a custom design) does not have to provide all the necessary templates. Whenever eZ publish is unable to find a template within the main design of the siteaccess, the system will look for it in the additional designs and the standard design.

Commonly used system templates

The following table shows some of the most commonly used system templates.

Request

URL

Module

View

Template

Search interface

/content/search

content

search

/templates/content/search.tpl

Shopping basket

/shop/basket

shop

basket

/templates/shop/basket.tpl

Login page

/user/login

user

login

/templates/user/login.tpl

User registration

/user/register

user

register

/templates/user/register.tpl

Balazs Halasy (04/03/2005 1:42 pm)

Balazs Halasy (24/05/2005 9:18 am)


Comments

There are no comments.