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

View results, the path and the pagelayout

What a view returns in $Result - content, path, navigation part, a different or no pagelayout - how the pagelayout receives it as $module_result, and how to answer with JSON or a file instead of a page.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-3-extension-developer/view-results-and-the-pagelayout.md

On this page

View results, the path and the pagelayout

Part 3, chapter 12. A view does not print a page. It returns a result, and the kernel wraps it in the pagelayout, the template of the site's frame (header, menu, footer). This chapter lists what a result can hold and how the pagelayout uses it. The code is ezpKernelWeb (kernel/private/classes/ezpkernelweb.php).

The result array

KeyMeaning
contentthe HTML of the page body, usually $tpl->fetch( 'design:...' )
paththe breadcrumb: a list of array( 'text' => ..., 'url' => ... ), url false for the current page
navigation_partwhich top tab of the administration is active (else the view's default_navigation_part)
pagelayoutfalse for no frame; a template name to use another frame
content_infofor content views, information about the node shown (class, section, node ID ...)
<?php
$Result = array();
$Result['content'] = $tpl->fetch( 'design:hello/world.tpl' );
$Result['path'] = array(
    array( 'text' => ezpI18n::tr( 'mysite_hello', 'Hello' ), 'url' => '/hello/list' ),
    array( 'text' => $name, 'url' => false )
);

A view written as a class returns the same array from run().

In the pagelayout: $module_result

The pagelayout gets the result as $module_result, with keys the kernel adds: uri, ui_context, ui_component, is_mobile_device. It prints the body with:

{$module_result.content}

(no wash: it is HTML the view built), and the breadcrumb from $module_result.path. A design's pagelayout is templates/pagelayout.tpl; the administration designs have their own.

Another frame, or none

<?php
$Result['pagelayout'] = false;                    // only the content: a fragment, a popup body
$Result['pagelayout'] = 'popup_pagelayout.tpl';   // another frame, found as design:popup_pagelayout.tpl

A value with a : is used as a full template resource. The kernel's own content tree menu returns $Result['pagelayout'] = false (kernel/private/classes/views/content/treemenu.php).

Answering with JSON or a file

For data, not a page, write the output and end the request:

<?php
header( 'Content-Type: application/json; charset=utf-8' );
echo json_encode( array( 'name' => $name, 'count' => $count ) );
eZExecution::cleanExit();

eZExecution::cleanExit() runs the kernel's shutdown properly. Under Velocity it ends the request by throwing; never wrap a download and cleanExit() in a try { } catch ( Exception $e ), or the page is appended to your output. For ajax calls, an ezjscore server function is usually the better tool: Ajax with ezjscore server functions.

Titles and meta data

The page title in the browser is built by the pagelayout from the path (title_path in some designs) and the site name. A view that wants a specific title puts it in the last path element.

Content views and persistent variables

Content views (node/view/full.tpl and overrides) can set values for the pagelayout with {set scope=global persistent_variable=hash( 'left_menu', false() )}; they arrive in $module_result.content_info.persistent_variable. Module views simply put what the pagelayout needs into the result or into template variables.

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