Learning: Pagelayout.tpl

Pagelayout is the main template. It contains the HTML, HEAD and BODY tags and sets the overall looks of the site. The following example is a basic pagelayout.tpl

<!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="en" lang="en">

<head>

<style type="text/css">

</style>

{include uri='design:header.tpl'}

</head>

<body>

{$module_result.content}

Cascading Style Sheets

The paylayout example makes use of a single stylesheet – common.css.

The command that imports the stylesheet refers to the correct design for the site and then accesses the file from the design directory. This makes sure you get the right stylesheet incase there is stylesheet with the same name in the default design.

Eg. if the design name is “fedora” and the css file was “funky.css” the following output would be created.

@import url("/design/fedora/stylesheets/funky.css");

If the stylesheet specified doesn’t exist, ez publish will fall back to the stylesheets provided with the default design.

Module result

In every request, eZ publish creates the array “module_result”. This is available only in the pagelayout template (ie. not in any templates included within the pagelayout template).

It contains information about the module that was run, the view requests and the output produced. The output is accessible in the content element of the array

Eg. {$module_result.content}