ez.no / ezpublish / documentation / customization / custom design / file placement
These documentation pages are no longer maintained. Please visit the new documentation site.
The templates are parsed in two steps. First we have a template that defines the overall layout of the site and then we have a template to view the actual node.
This template may contain HTML headers, menus and tables. The template is called pagelayout.tpl and is placed directly in the templates/ directory.
Simple pagelayout:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="no" lang="no"> <head> <title>Welcome to my site</title> <link rel="stylesheet" type="text/css" href={'stylesheets/core.css'|ezdesign} /> </head> <body> <h1>My site</h1> <table class="layout" width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="120" valign="top" style="padding-right: 4px;"> {include uri='design:left_menu.tpl'} </td> <td class="mainarea" width="99%" valign="top"> {include uri='design:page_mainarea.tpl'} </td> </tr> </table> </body> </html>
As you can see the pagelayout is a very simple file that only defines the general layout of the site. Two places we use a function called include to include another template. This is to separate the different components on the page in their own files. We recommend that you have as little advanced code as possible in this file to make it easy as possible to maintain.
The including of the file page_mainarea.tpl is used to include the actual node we have chosen to view. As long as we include this file (or place the content of this template directly into our pagelayout), eZ publish will take care of the rest for us.
After the pagelayout file is done the correct template for viewing the node is found. Which file is used is based on the URL. If the URL is /content/view/full/2 then a template called full.tpl is used (based on the third element in the URL). The $node object will be the node with ID 2. All files for viewing nodes are placed in templates/node/view/ in our design directory.
In this template we can print out all data in the data map of the node, print all children of the node or both.
We can add more information after the normal URL (i.e. /content/view/full/2) and it is treated as extra parameters we can access in our template. All these parameters are placed in an array called $view_parameters. Parameters are placed in the URL as key/value pairs in the same way as when we create an associative array. The URL /content/view/full/2/limit/10/offset/30 will show the URL /content/view/full/2 and the $view_parameters array will have the limit and offset values set to 10 and 30. We can access these variables in the templates as with any other array.
Example:
{$view_parameters.offset}
This would output:
30
Comments
Concerning "Extra Parameters"
Marco Zinn
Tuesday 10 February 2004 10:33:36 pm
I think, only "offset" and "limit" is support.
A more general solution is announced for 3.4.