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

Include

Splitting templates into parts with include: the design resource, passing parameters, what the included template sees, naming parts, and include versus node_view_gui and overrides.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/designers/templates/include.md

On this page

Include

This page is for designers who split templates into reusable parts: a header, a teaser, a share bar.

Contents

  1. Syntax
  2. Passing parameters
  3. What the included template sees
  4. Dynamic paths
  5. Include or node_view_gui?

Syntax

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

design: means "find this path under templates/ through the design cascade", so a design higher in the chain can replace the part by placing a file at the same path (The design cascade).

Passing parameters

Every other name=value becomes a variable in the included template:

{include uri='design:parts/teaser.tpl' node=$child show_image=true() image_class='small'}

In the part, give optional parameters a default:

{* design/mytheme/templates/parts/teaser.tpl *}
{default show_image=false() image_class='medium'}
<article class="teaser">
    {if and( $show_image, $node.data_map.image.has_content )}
        {attribute_view_gui attribute=$node.data_map.image image_class=$image_class}
    {/if}
    <h3><a href={$node.url_alias|ezurl}>{$node.name|wash}</a></h3>
</article>

What the included template sees

The part sees the variables of its includer plus the parameters. Variables it defines with {def} stay in the shared namespace until {undef}; that is why parts should {undef} what they define and use prefixed names (Variables and def).

Dynamic paths

The path can be built:

{include uri=concat( 'design:parts/icon_', $type, '.tpl' )}

The layouts engine includes block templates this way (concat( 'design:explayouts/block/', $block.definition_identifier, '.tpl' )). A path that does not exist is a template error: make sure every possible value has a file.

Include or node_view_gui?

UseWhen
{include}a part of the frame, or markup that does not depend on the content class
{node_view_gui content_node=$child view='line'}drawing a node: the view mode's template is chosen through overrides, per class (node_view_gui)

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