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

Common template mistakes

The template mistakes that cause most bugs, security holes and slow pages, each with its symptom and fix: unwashed output, fetch in loops, missing limits, cache keys, user data in cached views, quotes around ezurl…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/designers/templates/common-template-mistakes.md

On this page

Common template mistakes

This page is for designers who want to avoid the usual traps. Each mistake has a symptom, so you can also use the page to find the cause of a problem.

Contents

  1. Output and security
  2. Data and speed
  3. Caching
  4. Syntax
  5. Files and caches

Output and security

MistakeSymptomFix
printing a value without |washHTML from content breaks the page; script injection possiblewash at output (Wash and escaping)
washing rich text outputtags shown as textdo not wash attribute_view_gui output
washing twice& on the pagewash once, at the end
inline <script> or onclickblocked under a Content Security Policyscript files (No inline JavaScript)

Data and speed

MistakeSymptomFix
a fetch inside a foreachslow pages, many queries in the debug outputone fetch before the loop (Fetch performance)
a list fetch without limitvery slow pages on big foldersalways a limit, paginate
reading $node.children for a menuall children loaded with all dataa fetch with limit and class_filter_array
drawing an empty fieldempty wrappers, stray labelstest has_content first

Caching

MistakeSymptomFix
user data in a view-cached full viewone visitor sees another's namemove it to the pagelayout or vary the cache (Caching for designers)
a cache-block without the current page in its keysthe menu marks the wrong pageadd $module_result.uri or the node id to keys
csp_nonce() in cached outputscripts blocked on later visitsscript files; nonce only outside caches
currentdate() or rand() in cached outputdate or random value frozencompute it outside cached parts

Syntax

MistakeSymptomFix
quotes around ezurl: href="{$x|ezurl}"href=""/path"" broken attributewrite href={$x|ezurl}, or ezurl( 'no' ) inside your quotes (URL operators)
$a == $bparse erroreq( $a, $b )
{def} of an existing variablewarning, includer's value overwrittenprefixes and {undef} (Variables and def)
comparing strings with gtunexpected resultsgt compares lengths of non-numeric strings (Logic and comparison operators)
an operator from an inactive extension"Operator '...' is not registered" in the debug output, nothing printedactivate the extension or use another operator

Files and caches

MistakeSymptomFix
editing a template in design/standard or a shipped themechange lost on upgradecopy it into your design (The design cascade)
a new template or override not showingold template still used, or empty content areaclear template-override (Debugging a design)
an override with a typo in MatchFilerule ignored, error log entrycheck the path under override/templates/
two overrides for the same sourcethe wrong one winsPriority (Override ordering)

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