14.7. Layouts

A layout is an HTML file that provides the markup for the overall look of a page. A layout is generally used to implement headers and footers, specify which stylesheets and scripts to use, and define the locations for content and regions. Layouts can include PHP code. Place layouts in the layouts/scripts folder under your module's folder. Assign filenames using the format layoutname-layout.phtml.

For the system to function correctly, your layout needs to output the various scripts, CSS, metadata, etc. that modules have registered. This is generally accomplished by using the following template:

<?= $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <?= $this->headMeta() ?>
    <?= $this->headTitle() ?>
    <?= $this->dojo() ?>
    <?= $this->headLink() ?>
    <?= $this->headScript() ?>
    <?= $this->headStyle() ?>
<body class='claro
 <?= $this->layout()->getLayout() ?>
 <?= $this->request()->getModuleName() ?>-module
 <?= $this->request()->getControllerName() ?>-controller
 <?= $this->request()->getActionName() ?>-action'>

<div id="content">
    <?= $this->layout()->content ?>

<?= $this->toolbar() ?>
<?= $this->notifications() ?>


For details, see Section 11.3, “Layouts” and the Zend Framework documentation.

Perforce Chronicle - Release: 2012.2/486814