The pagelayout
The pagelayout is the main template of a siteaccess. Exponential renders it around the result of every view, so it holds what every page shares: the html, head and body elements, the stylesheets and scripts, the header, the menus and the footer. Its file is templates/pagelayout.tpl of a design; like any template it is taken from the first design of the design chain that has one.
A minimal pagelayout
<!DOCTYPE html>
<html lang="{$site.http_equiv.Content-language|wash}" dir="{$site.text_direction|wash}">
<head>
{include uri='design:page_head.tpl'}
{ezcss_load( array( 'core.css', 'debug.css',
ezini( 'StylesheetSettings', 'FrontendCSSFileList', 'design.ini' ) ) )}
{ezscript_load( ezini( 'JavaScriptSettings', 'FrontendJavaScriptList', 'design.ini' ) )}
</head>
<body>
{$module_result.content}
<!--DEBUG_REPORT-->
{include uri='design:pagelayout/hooks/body_end.tpl'}
</body>
</html>
- {include uri='design:page_head.tpl'} prints the title, the meta tags and the link tags of the page; see The page head.
- ezcss_load and ezscript_load (from the ezjscore extension, which the standard pagelayout uses too) print the stylesheets and scripts, found in the design chain like templates. With the packer on, they are joined into one file each. The lists in design.ini let extensions add their files: FrontendCSSFileList[] and FrontendJavaScriptList[] for the site, BackendCSSFileList[] and BackendJavaScriptList[] for the administration interface.
- {$module_result.content} prints the result of the view: the node, the search page, the login form. The other keys of $module_result, and the other variables of the pagelayout, are listed in Variables in pagelayout.
- <!--DEBUG_REPORT--> is replaced with the debug output when debug output is on for the request, and removed otherwise. Without it, the debug output is added after the end of the page. See Debugging templates.
- pagelayout/hooks/body_end.tpl prints what extensions register in site.ini [PageLayoutHooks] BodyEnd[], such as analytics. Every shipped pagelayout includes it just before </body>; see Pagelayout hooks.
The standard design's own pagelayout.tpl is a complete example with a top box, a path, menus and a footer; read it, but copy it into your design before changing it.
Cache blocks in the pagelayout
The pagelayout runs for every page, also when the view's result comes from the view cache. Parts that are the same on many pages, such as the menu or the footer, belong in {cache-block}s, so their fetches run only when the cache is stale:
{cache-block keys=array( $module_result.uri, $current_user.role_id_list|implode( ',' ) )}
{include uri='design:parts/main_menu.tpl'}
{/cache-block}
Choose the keys with care: what a cache block prints may depend only on its keys, the siteaccess and the template. See Template caching and cache-block.
Other pagelayouts
A view can ask for another pagelayout in its result ($module_result.pagelayout), as the sign-in page does with loginpagelayout.tpl. The layout module renders any page with the pagelayout of a layout named in layout.ini: /layout/set/print/<address> uses print_pagelayout.tpl. A node template can ask whether it is rendered in such a layout with the override key layout: {if $DesignKeys:used.layout|eq( 'print' )}. The standard design has print_pagelayout.tpl, popup_pagelayout.tpl and fullscreen_pagelayout.tpl for the layouts print, popup and fullscreen.
In other template engines
A pagelayout can also be written in Smarty or Twig (pagelayout.stpl, pagelayout.twig), chosen with an override rule whose Source is pagelayout.tpl; the converters write such rules for a converted design. See Template engines.
In this section
- The page head The standard page_head.tpl of Exponential 6: the title, meta tags, link tags and the parameters of the include.
- Variables in pagelayout The variables of the Exponential 6 pagelayout: $module_result, $site, $current_user and the others, with the keys of $module_result.
- XHTML validation / The pagelayout / Templates / 6.x / Tec... Exponential Documentation
Contributors
- Balazs Halasy
- Geir Arne Waaler
- Charles Commenter
- Jozef Baum Commenter
- Svitlana Shatokhina Commenter
- Leonardo López Commenter
- Finn Mathisen Commenter
- Graham Brookins Updated Maintainer
Comments (7 historical)
Written by readers of the earlier documentation sites, kept as they were.
Unique page layout per folder?
Charles ·
Would it be possible to specify a different page layout for different folders on a site? For example, a different header image and style sheet that is used when displaying the folder as well as when displaying content items within the folder.
Question answered here:
Charles ·
This question was answered for me in the forums:
http://ez.no/community/forum/setu...out_for_different_folders/#msg104383
XHTML validation
Jozef Baum ·
A plain_site setup of Exponential is not even valid XHTML 1.0 Transitional.
Also http://ez.no/ is not even valid XHTML 1.0 Transitional.
Re: XHTML validation
Svitlana Shatokhina ·
Hi, http://ez.no seems to be okay now. I also filed an issue for plain_site: http://issues.ez.no/12716
Next time, you can report problems directly to the issue tracker. Thank you!
$module_result.content inside a "iframe"
Leonardo López ·
i'm trying to put the $module_result.content inside a iframe tag but is not working that i hope... its not possible to make that??? what can i do?
Illustrations
Finn Mathisen ·
The illustrations are not shown
The HTML tag
Jozef Baum ·
The HTML tag doesn't include a URL to the XHTML specification, but a URL to the XML namespace.