Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,113 of 9,113 pages
About the help in other languages
All help pages

Pagelayout variables

Every variable the kernel gives the pagelayout ($module_result, $site, $current_user, $access_type, $ui_context and more), the keys of $module_result.content_info for content pages, and examples of using them.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/designers/theme-design/pagelayout-variables.md

On this page

Pagelayout variables

This page is for designers who write or read a pagelayout. It lists the variables the kernel sets before it renders pagelayout.tpl, as set in kernel/private/classes/ezpkernelweb.php, and the keys a content view adds in kernel/classes/eznodeviewfunctions.php.

Contents

  1. The variables
  2. $module_result
  3. $module_result.content_info on content pages
  4. $site
  5. Examples
  6. Variables you should not expect

The variables

VariableWhat it holds
$module_resultwhat the module view produced (a hash, below)
$sitethe site's title, design, HTTP header values, URI, meta data, version, text direction
$current_userthe signed-in user (an eZUser), the anonymous user for visitors; false on the few pages that run without a user object
$anonymous_user_idsite.ini [UserSettings] AnonymousUserID
$access_typethe matched siteaccess (name, the match type ...)
$navigation_partthe navigation part of the view (the admin uses it for the active tab)
$uri_stringthe URI of the request as the kernel resolved it
$requested_uri_stringthe URI as requested (before a URL alias was translated)
$ui_contextthe context of the view as its module declares it, for example view, edit, browse, administration, authentication (the ui_context entries of kernel/*/module.php)
$ui_componentthe module name of the view
$warning_listkernel warnings to show, or false

$module_result

KeyContent
contentthe HTML of the view: print it once with {$module_result.content}
paththe breadcrumb path: a list of hashes with text, url, url_alias, node_id; false when the view sets none
title_pathlike path, for the <title>
urithe request URI
content_infofor content views: facts about the node shown (below)
view_parametersthe view parameters of the URL, e.g. (offset)/20 gives offset 20
node_id, section_idfor content views
navigation_partidentifier of the navigation part
ui_context, ui_componentas above
is_mobile_device, mobile_device_aliasfrom the kernel's mobile device detection
errorType, errorNumberon error pages (the media design's title template reads them)

$module_result.content_info on content pages

A content view (content/view) fills content_info with these keys (from eZNodeviewfunctions):

KeyExample use
node_id, object_id, parent_node_idfetch the node; mark the current menu item
class_id, class_identifiera class-specific body class or header
viewmodefull, or a special mode such as the media design's payload
node_depthhow deep the page is in the tree
url_alias, main_node_url_aliascanonical links
section_id, section_identifier, navigation_part_identifiersection-based styling
remote_id, node_remote_id, parent_node_remote_id, parent_object_remote_idstable identifiers that do not change between installations
parent_class_id, parent_class_identifierstyling by the parent's class
class_group, state, state_identifierclass groups and object states
current_language, language_maskthe language shown
offsetthe paging offset
persistent_variablewhat view templates set for the pagelayout (The persistent variable)

content_info is not an array on pages of other modules (search, user, error). Always test before you read it:

{if and( is_array( $module_result.content_info ), is_set( $module_result.content_info.class_identifier ) )}
    ...
{/if}

$site

KeyContent
titlesite.ini [SiteSettings] SiteName
designsite.ini [DesignSettings] SiteDesign
http_equiv.Content-Typetext/html; charset=...
http_equiv.Content-languagethe language of the page, for <html lang="...">
text_directionrtl for a right-to-left interface language, else ltr
urithe original URI object
metasite.ini [SiteSettings] MetaDataArray, with a description built from the path when none is set
versionthe Exponential version
page_titlethe module's title

Examples

A body class per content class, so one stylesheet can style article pages differently from folders:

{def $body_class = 'page'}
{if and( is_array( $module_result.content_info ), is_set( $module_result.content_info.class_identifier ) )}
    {set $body_class = concat( 'page page-', $module_result.content_info.class_identifier )}
{/if}
<body class="{$body_class|wash}">

A signed-in user's name in the header:

{if $current_user.is_logged_in}
    <span class="user-name">{$current_user.contentobject.name|wash}</span>
    <a href={'/user/logout'|ezurl}>{'Sign out'|i18n( 'design/mytheme' )}</a>
{else}
    <a href={'/user/login'|ezurl}>{'Sign in'|i18n( 'design/mytheme' )}</a>
{/if}

The language attribute and direction:

<html lang="{$site.http_equiv.Content-language|wash}"{if eq( first_set( $site.text_direction, 'ltr' ), 'rtl' )} dir="rtl"{/if}>

Variables you should not expect

  • $node: not set in the pagelayout (the kernel unsets it); fetch the node from content_info.node_id (since 3.9, see doc/eng-us/features/3.9/no_more_node_in_pagelayout.txt).
  • Variables of view templates: a {def} in node/view/full.tpl does not reach the pagelayout. Use the persistent variable to hand values over.
  • Anything user-specific inside a cache-block without the user in the keys: the cached copy would be shown to everybody.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x