Skip to the content
Documentation

Template operators

No ratings yet

Exponential 6 in this section

Exponential 6 adds operators in every area: the PHP string functions (6.0.13), the role and policy checks (6.0.12), and the operators of the newer kernel features (Content Security Policy nonce, view parameters, the siteaccess menu and addresses, the environment and installation name, the transfer registry, Smarty and Twig rendering). Older operators that the 4.x reference never described have their own pages now as well.

Arrays

Operator Summary
append Returns the input array with appended elements.
array Creates and returns a new array.
array_sum Returns the sum of all elements in an array.
begins_with Checks if an array starts with a specific element/sequence.
compare Compares the contents of two arrays.
contains Checks if an array contains a specific element.
ends_with Checks if an array ends with a specific element or sequence.
explode Splits the input array and returns it as an array of sub-arrays.
extract Returns a portion of the input array.
extract_left Returns a portion of the start of the input array.
extract_right Returns a portion of the end of the input array.
hash Creates and returns a new associative array (a hash).
implode Joins array elements with strings.
insert Inserts an element/sequence at specified position in an array.
merge Merges input and passed arrays into one array.
prepend Returns the input array prepended with specified elements.
remove Returns the input array without some of the original elements.
repeat Returns a repeated version of the input array.
replace Replaces elements in an array.
reverse Returns a reversed version of the input array.
unique Returns the input array without duplicate elements.

Data and information extraction

Operator Summary
currentdate Returns the timestamp of the current date/time.
ezhttp Returns GET, POST, session and cookie variables.
ezhttp_hasvariable Returns TRUE if the specified HTTP variable is set.
ezini Provides read access to settings in the configuration files.
ezini_hasvariable Returns TRUE if the specified configuration directive is set.
ezmodule Returns TRUE if the specified module or view is enabled.
ezpreference Provides access to a user's preference values.
ezsys Returns misc values such as wwwdir, sitedir, etc.
fetch Provides access to the fetch functions of a module.
module_params Extracts parameters from the module that was run.

Formatting and internationalization

Operator Summary
d18n Marks a string for translation. Valid from 4.3
datetime Formats dates/times according to settings in "datetime.ini".
i18n Marks a string for translation.
l10n Formats misc. numbers (times, dates, currencies, numbers, etc.).
si Handles unit display of values (output formatting).

Images

Operator Summary
image Creates and returns an image object.
imagefile Loads an image from a file.
texttoimage Renders a string as an image using a truetype font.

Logical operations

Operator Summary
and Evaluates all parameters to check if any are evaluated as FALSE
choose Returns one of the parameters (pinpointed by the input parameter).
cond Returns the value of the first clause who's condition is TRUE.
eq Returns TRUE if the input equals the first parameter or if all parameters are equal.
false Creates and returns a boolean FALSE.
first_set Returns the first parameter that is set (or FALSE).
ge Returns TRUE if a parameter is greater than or equal to another parameter.
gt Returns TRUE if a parameter is greater than another parameter.
le Returns TRUE if a parameter is less than or equal to another parameter.
lt Returns TRUE if a parameter is less than another parameter.
ne Returns TRUE if one or more of the parameters do not match.
not Returns the opposite of the input or the first parameter (TRUE/FALSE).
null Returns TRUE if the input value is NULL (not the same as 0).
or Evaluates all parameters until one is found to be TRUE, returns that value.
true Creates and returns a boolean TRUE.

Mathematics

Operator Summary
abs Returns a positive value of either the input or the first parameter.
ceil Returns the next highest integer value of input or parameter.
dec Returns input or parameter decremented by one.
div Divides input or first parameter by the remaining parameters.
floor Returns the next lowest integer value of input or parameter.
inc Increments either the input or the first parameter with one.
max Returns the largest value of all parameters.
min Returns the smallest value of all parameters.
mod Returns the modulo of two parameters.
mul Multiplies all parameters and returns the result.
rand Returns a random integer.
round Returns a rounded version of the input or a parameter value.
sub Subtracts all remaining parameters from the first parameter.
sum Returns the sum of all parameters.

Miscellaneous

Operator Summary
action_icon Not documented yet.
attribute Makes it possible to inspect the contents of arrays, hashes and objects.
classgroup_icon Outputs an image tag referencing a class group icon.
class_icon Outputs an image tag referencing a class icon.
content_structure_tree Not documented yet.
dump Makes it possible to inspect the contents of arrays, hashes and objects. Alias of attribute() available in 4.7 and higher which is simpler to use.
ezpackage Not documented yet.
flag_icon Outputs an image tag referencing a flag icon.
gettime Converts a UNIX timestamp to a human friendly structure.
icon_info Not documented yet.
makedate Generates the UNIX timestamp of a given date.
maketime Generates the UNIX timestamp of a given date/time.
mimetype_icon Outputs an image tag referencing a MIME type icon.
month_overview Generates a structure that can be used to build a calendar.
pdf Provides access to the PDF functions (DEPRECATED).
roman Generates a roman representation of a number.
topmenu Not documented yet.
treemenu Fetches a subtree of nodes for the purpose of menu generation.

Strings

Operator Summary
append Returns the input string with a custom sequence appended to it.
autolink Returns the input string with the addresses replaced by link tags.
begins_with Checks if a string starts with a specific character/sequence.
break Returns the input string with all newlines converted to HTML breaks.
chr Generates a string based on the input array of ASCII/UNICODE values.
compare Compares the contents of two strings.
concat Merges several strings into one string.
contains Checks if a string contains a specific element.
count_chars Returns the length of the input string.
count_words Returns the number of words that make up the input string.
crc32 Returns the CRC32 polynomial of the input string.
downcase Returns a lowercased version of the input string.
ends_with Checks if a string ends with a specific character/sequence.
explode Splits the input string and returns it as an array of strings.
extract Returns a portion of the input string.
extract_left Returns a portion of the start of the input string.
extract_right Returns a portion of the end of the input string.
indent Returns an indented version of the input string.
insert Returns the input string with additional text inserted at a specified position.
md5 Returns the MD5 hash of the input string.
nl2br Returns the input string with all newlines converted to HTML breaks.
ord Returns an array containing the ASCII/UNICODE values of the input string.
pad Returns a lengthened version of the input string.
prepend Returns the input string prepended with a custom sequence.
remove Returns a pruned version of the input string.
repeat Returns a repeated version of the input string.
replace Replaces elements in a string.
reverse Returns a reversed version of the input string.
rot13 Returns a ROT13 transformation of the input string.
shorten Returns a shortened version of the input string.
simpletags Returns a partially marked up version of the input string.
simplify Returns a simplified version of the input string.
trim Returns a stripped version of the input string.
upcase Returns a capitalized version of the input string.
upfirst Returns the input string with a capitalized initial letter.
upword Returns the input string with capitalized initial letters.
wash Returns an HTML-safe version of the input string.
wordtoimage Returns the input string with embedded image tags.
wrap Returns a wrapped version of the input string.

URLs

Operator Summary
exturl Not documented yet.
ezdesign Returns the input string prepended with the current design directory.
ezimage Returns the input string prepended with the current image directory.
ezroot Same as "ezurl" without "index.php" and the siteaccess name in the returned address.
ezurl Returns a working version of an Exponential URL (provided as input).

Variable and type handling

Operator Summary
count Returns the count of the input parameter.
float Converts the input parameter to a float.
get_class Returns the class name of an object.
get_type Returns the type of the provided variable.
int Converts the input parameter to an integer.
is_array Returns TRUE if the provided variable is an array.
is_boolean Returns TRUE if the provided variable is a boolean.
is_class Returns TRUE if an object is an instance of a specific class.
is_float Returns TRUE if the provided variable is a float.
is_integer Returns TRUE if the provided variable is an integer.
is_null Returns TRUE if the provided variable is NULL.
is_numeric Returns TRUE if the provided variable is a number.
is_object Returns TRUE if the target variable is an object.
is_set Returns TRUE if the value of the provided variable is set.
is_string Returns TRUE if the provided variable is a string.
is_unset Returns TRUE if the provided variable is not set (has no value).

New in Exponential 6

The operators that arrived in the 6.0.x releases, by category. Each name links to its page.

By release: 6.0.12: 7; 6.0.13: 60; 6.0.15 (in development): 20.

New in Exponential 6: Miscellaneous

Name Description Since
audit_label The readable, translated label of an audit event name. 6.0.15 (in development)
csp_nonce The Content Security Policy nonce of this request, for an inline script. 6.0.15 (in development)
exp_demo_mode True while the installation runs in demo mode. 6.0.15 (in development)
exp_environment The name of the environment (EXP_ENV in config.env.php). 6.0.15 (in development)
exp_environment_badge The environment badge of this request (level and label), from site.ini [AdminEnvironment]. 6.0.15 (in development)
exp_smarty_render Renders a Smarty template (.stpl) with the template variables of the current namespace. 6.0.15 (in development)
exp_twig_render Renders a Twig template (.twig) with the template variables of the current namespace. 6.0.15 (in development)
expinfo Metadata of the installation and its extensions (versions, what is active, which operators exist). 6.0.15 (in development)
installation_name The name of the installation (empty on production with hide_on_prod). 6.0.15 (in development)
is_production_system True when the installation is a production system. 6.0.15 (in development)
transfer_actions The import and export actions of the transfer registry for a context (a container, a class ...). 6.0.15 (in development)
transfer_related The tools a "Looking for ...?" box offers next to a transfer tool. 6.0.15 (in development)
transfer_tool One tool of the transfer registry, or false. 6.0.15 (in development)
transfer_tools The import and export tools of the transfer registry the current user may use, filtered. 6.0.15 (in development)
view_parameter A value encoded as the value of a view parameter, /(name)/<value>. 6.0.15 (in development)

New in Exponential 6: Strings

Name Description Since
addcslashes PHP addcslashes(): backslashes before the given characters. 6.0.13
addslashes PHP addslashes(): backslashes before quotes, backslash and NUL. 6.0.13
bin2hex PHP bin2hex(): the hexadecimal form of the text. 6.0.13
chunk_split PHP chunk_split(): the text split into chunks of a given length. 6.0.13
convert_uudecode PHP convert_uudecode(): decodes a uuencoded text. 6.0.13
convert_uuencode PHP convert_uuencode(): uuencodes the text. 6.0.13
hebrev PHP hebrev(): logical Hebrew text to visual text. 6.0.13
hex2bin PHP hex2bin(): the text of a hexadecimal string (false for invalid input). 6.0.13
html_entity_decode PHP html_entity_decode(): HTML entities back to characters. 6.0.13
htmlentities PHP htmlentities(): every character that has an HTML entity, as that entity. 6.0.13
htmlspecialchars_decode PHP htmlspecialchars_decode(): the special HTML entities back to characters. 6.0.13
lcfirst PHP lcfirst(): the first character in lower case. 6.0.13
levenshtein PHP levenshtein(): the edit distance between two texts. 6.0.13
ltrim PHP ltrim(): the text without white space (or given characters) at the start. 6.0.13
metaphone PHP metaphone(): the metaphone key of the text. 6.0.13
number_format PHP number_format(): a number with grouped thousands and given decimals. 6.0.13
quoted_printable_decode PHP quoted_printable_decode(): decodes a quoted-printable text. 6.0.13
quoted_printable_encode PHP quoted_printable_encode(): the text as quoted-printable. 6.0.13
quotemeta PHP quotemeta(): backslashes before the regular expression meta characters. 6.0.13
rawurldecode PHP rawurldecode(): decodes an RFC 3986 encoded text. 6.0.15 (in development)
rawurlencode PHP rawurlencode(): the text encoded as RFC 3986 (a space is %20), for path segments. 6.0.15 (in development)
ristring Replaces text, case-sensitive (PHP str_replace). 6.0.13
rstring Replaces text, case-insensitive (PHP str_ireplace). 6.0.13
rtrim PHP rtrim(): the text without white space (or given characters) at the end. 6.0.13
similar_text PHP similar_text(): the number of matching characters of two texts. 6.0.13
soundex PHP soundex(): the soundex key of the text. 6.0.13
sprintf PHP sprintf(): the input as the format, the parameters as its values. 6.0.13
str_contains PHP str_contains(): true when the text contains the needle. 6.0.13
str_ends_with PHP str_ends_with(): true when the text ends with the needle. 6.0.13
str_getcsv PHP str_getcsv(): a CSV line as an array. 6.0.13
str_shuffle PHP str_shuffle(): the characters of the text in random order. 6.0.13
str_split PHP str_split(): the text as an array of chunks. 6.0.13
str_starts_with PHP str_starts_with(): true when the text starts with the needle. 6.0.13
str_word_count PHP str_word_count(): the number of words, or the words as an array. 6.0.13
strcasecmp PHP strcasecmp(): compares two texts, case-insensitive. 6.0.13
strcmp PHP strcmp(): compares two texts. 6.0.13
strcoll PHP strcoll(): compares two texts by the current locale. 6.0.13
strcspn PHP strcspn(): the length of the start that has none of the given characters. 6.0.13
strip_tags PHP strip_tags(): the text without HTML and PHP tags. 6.0.13
stripcslashes PHP stripcslashes(): undoes addcslashes. 6.0.13
stripos PHP stripos(): the position of the first occurrence, case-insensitive (false if none). 6.0.13
stripslashes PHP stripslashes(): undoes addslashes. 6.0.13
stristr PHP stristr(): the text from the first occurrence of the needle on, case-insensitive. 6.0.13
strlen PHP strlen(): the length of the text in bytes. 6.0.13
strnatcasecmp PHP strnatcasecmp(): compares two texts in natural order, case-insensitive. 6.0.13
strnatcmp PHP strnatcmp(): compares two texts in natural order. 6.0.13
strncasecmp PHP strncasecmp(): compares the first n characters, case-insensitive. 6.0.13
strncmp PHP strncmp(): compares the first n characters. 6.0.13
strpbrk PHP strpbrk(): the text from the first of the given characters on. 6.0.13
strpos PHP strpos(): the position of the first occurrence (false if none). 6.0.13
strrchr PHP strrchr(): the text from the last occurrence of a character on. 6.0.13
strripos PHP strripos(): the position of the last occurrence, case-insensitive (false if none). 6.0.13
strrpos PHP strrpos(): the position of the last occurrence (false if none). 6.0.13
strspn PHP strspn(): the length of the start made only of the given characters. 6.0.13
strstr PHP strstr(): the text from the first occurrence of the needle on. 6.0.13
strtok PHP strtok(): the first token of the text. 6.0.13
strtr PHP strtr(): translates characters or replaces substrings. 6.0.13
substr PHP substr(): part of the text. 6.0.13
substr_compare PHP substr_compare(): compares part of the text with another text. 6.0.13
substr_count PHP substr_count(): how often the needle occurs. 6.0.13
substr_replace PHP substr_replace(): replaces part of the text. 6.0.13
vsprintf PHP vsprintf(): the input as the format, an array as its values. 6.0.13

New in Exponential 6: URLs

Name Description Since
siteaccess_menu The siteaccesses of the administration's site menu, with their addresses, for a user. 6.0.15 (in development)
siteaccess_menu_key A key for the cache blocks of the site menu. 6.0.15 (in development)
siteaccess_url The address of a siteaccess's front page (scheme, host, port and siteaccess path). 6.0.15 (in development)

New in Exponential 6: Variable and type handling

Name Description Since
has_any_role True when the user has at least one of the roles (all of them with match_all). 6.0.12
has_policy True when one of the user's roles has a policy for the module and function. 6.0.12
has_policy_by_user True when one of the given user object's roles has a policy for the module and function. 6.0.12
has_role True when the user (the current one, or user_id) has a role with this name. 6.0.12
has_role_by_user True when the given user object has the role. 6.0.12
has_role_by_user_id True when the user with that id has the role. 6.0.12
has_role_id True when the user has the role with this id. 6.0.12

Older than Exponential 6, first described here

These existed before Exponential 6 (or come from an extension, as the Since column says); the 4.x reference had no page for them.

Name Description Since
alphabet The letters of the alphabet of the current locale, for alphabetical navigation. older than 6.0
array_append Deprecated alias of append: the input array with the parameters added at the end. older than 6.0
array_merge Deprecated alias of merge: the input array merged with the arrays given as parameters. older than 6.0
array_prepend Deprecated alias of prepend: the input array with the parameters added at the start. older than 6.0
eztoc A table of contents built from the headings of an XML block attribute. older than 6.0
fetch_alias Runs a fetch alias defined in fetchalias.ini and returns its result. older than 6.0
getenv PHP getenv(): the value of an environment variable (operator of the extension bcgooglesitemaps). extension bcgooglesitemaps
icon The image tag of an icon of the active icon theme (as class_icon and the other icon operators). older than 6.0
language_switcher The addresses of the current page in the other siteaccesses and languages, for a language switcher. older than 6.0
locale The locale object (eZLocale) of the current locale, or of the locale given as parameter. older than 6.0
serialize PHP serialize(): the value as a stored representation (operator of the extension swark). extension swark
unserialize PHP unserialize(): the value back from its stored representation (operator of the extension swark). extension swark
urldecode PHP urldecode(): decodes a query string value. older than 6.0
urlencode PHP urlencode(): the text encoded for a query string (a space is +). older than 6.0
x18n Translates a text in the translation context of an extension (i18n with the extension's name). older than 6.0

Changed in Exponential 6

These pages have a section "Changed in Exponential 6.0.15" with what differs in 6.x:

Added for Exponential 6.0.15 and the earlier 6.0.x releases.

In this section

Contributors

Comments (5 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Custom template operators

    Tristan Rivoallan ·

    Is there a way to implement custom operators ?

  2. replacement operator?

    Maja Rom Anjer ·

    How do I do a simple replacement in a string?

    1. Re: replacement operator?

      Tiotmoun ·

      Maybe with
      {$str|explode(";")|implode(" ")}
      to replace ";" width " "

Comments

Add a comment

Comments are read by a moderator before they appear.