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

Templates overview

A map of Exponential's template language (TPL) for designers: what templates are, the kinds of templates a design has, the building blocks of the language (variables, functions, operators, fetches), how templates find…

Download as PDF

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

On this page

Templates overview

This page is for designers who start writing templates. Exponential's templates are text files ending in .tpl, written in its own template language (TPL), which mixes HTML with tags in braces: {$node.name|wash}, {foreach ...}, {include ...}. This page is the map; each section links to the details.

Contents

  1. What a template does
  2. The kinds of templates in a design
  3. The language in one screen
  4. Where templates get their data
  5. Reading path

What a template does

A template turns data (a node, a list, settings) into HTML. It has no access to the database or the file system except through fetch functions and operators the kernel and extensions provide, which keeps templates safe to hand to designers. Templates are compiled into PHP the first time they run and cached (Template compilation and cache).

The kinds of templates in a design

KindExample pathCalled by
Pagelayoutpagelayout.tplthe kernel, around every page (The pagelayout)
Node view templatesnode/view/full.tpl, node/view/line.tplcontent views, node_view_gui (View modes)
Override templatesoverride/templates/full/article.tploverride.ini rules (Override basics)
Datatype templatescontent/datatype/view/ezstring.tplattribute_view_gui (Datatype view templates)
Module templatesuser/login.tpl, content/search.tplmodule views
Partspagelayout/header.tpl, parts/teaser.tpl{include} from other templates
Layout block templatesexplayouts/block/list.tplthe layouts engine (Layouts for designers)

The language in one screen

{* a comment *}
{def $children = fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id,
                                                 'sort_by', $node.sort_array,
                                                 'limit', 10 ) )}
{if $children|count}
<ul class="children">
    {foreach $children as $child}
        <li><a href={$child.url_alias|ezurl}>{$child.name|wash}</a></li>
    {/foreach}
</ul>
{else}
<p>{'Nothing here yet.'|i18n( 'design/mytheme' )}</p>
{/if}
{undef $children}

Where templates get their data

  • Variables the caller sets: a full view gets $node; a datatype template gets $attribute; the pagelayout gets $module_result and $site (Pagelayout variables).
  • Fetch functions: fetch( 'content', 'list', ... ), fetch( 'user', 'current_user' ), fetch( 'explayouts', ... ) (Fetch basics).
  • Settings: ezini( 'Section', 'Setting', 'file.ini' ) (The ezini operator).
  • The request: ezhttp() for GET and POST values, carefully (The ezhttp operator).

Reading path

  1. TPL syntax basics, Variables and def, If and conditions, Foreach loops, Include.
  2. Wash and escaping, URL operators, The i18n operator.
  3. Fetch basics, Nodes, objects and attributes, View modes.
  4. Override basics, Override match keys.
  5. Template style guide, Common template mistakes.

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