Operators overview
This page is for designers who want the big picture of template operators: the functions that compute values in templates. The Operator reference lists every one.
Contents
Two call styles
$title|upcase {* pipe: input on the left *}
upcase( $title ) {* call *}
$text|shorten( 100, '...' ) {* pipe with parameters *}
$items|count|gt( 0 ) {* chained *}Some operators take no input and are only called: fetch( ... ), array( ... ), hash( ... ), true(),
currentdate(), ezini( ... ).
Where operators come from
| Source | Registered in | Examples |
|---|---|---|
| The template library | lib/eztemplate/classes/eztemplateautoload.php | array, hash, count, eq, cond, wash, shorten, l10n, fetch, sprintf |
| The kernel | kernel/common/eztemplateautoload.php | ezurl, ezroot, ezdesign, ezimage, ezini, ezhttp, i18n, csp_nonce, module_params, topmenu |
| PHP functions by setting | template.ini [PHP] PHPOperatorList[] | urlencode, urldecode, rawurlencode, rawurldecode |
| Extensions | extension/<ext>/autoloads/eztemplateautoload.php, when the extension is active and listed in site.ini [TemplateSettings] ExtensionAutoloadPath[] | ezjscore's ezcss_load, json_encode; ezwebin's ezpagedata; layouts' expl_* |
The families
| Family | Page |
|---|---|
strings: upcase, shorten, trim, wash, concat, PHP string functions | String operators, PHP string functions as operators |
arrays and hashes: array, hash, append, merge, contains, implode, explode, extract | Array operators |
logic: eq, ne, gt, and, or, not, is_set | Logic and comparison operators |
math: sum, sub, mul, div, mod, round, count | Math operators |
choice: cond, first_set, choose | cond and first_set |
escaping: wash | Wash and escaping |
URLs and design files: ezurl, ezroot, ezdesign, ezimage | URL operators |
translation and locale: i18n, l10n, datetime, currentdate | The i18n operator, Dates, numbers and l10n |
settings and request: ezini, ezhttp, ezpreference | The ezini operator, The ezhttp operator |
data: fetch | Fetch basics |
assets: ezcss_load, ezscript_load, json_encode | ezjscore template operators |
Does this operator exist here?
An operator from an extension exists only on siteaccesses where the extension is active. An unknown operator is reported in the debug output as "Operator '<name>' is not registered", and the template prints nothing for it. The generated example pages of the help list operators with examples where available. When you depend on an extension's operator, say so in your theme's README.
Related pages
- Operator reference
- TPL syntax basics
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
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.