Path

7x / documentation / ez publish / technical manual / 4.x / reference / template operators


Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Template operators

Arrays

OperatorSummary
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

OperatorSummary
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.
ezpagedata Extracts all the page data information.
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

OperatorSummary
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

OperatorSummary
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

OperatorSummary
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

OperatorSummary
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

OperatorSummary
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.
ezpagedata_append Appends a new value into a persistent variable.
ezpagedata_set Sets a new persistent variable into the page data.
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

OperatorSummary
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

OperatorSummary
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 eZ Publish URL (provided as input).

Variable and type handling

OperatorSummary
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).

Balazs Halasy (28/02/2005 9:10 am)

Balazs Halasy (16/06/2006 8:06 am)


Comments

  • Custom template operators

    Is there a way to implement custom operators ?
    • Re: Custom template operators

      There is even a wizard to help you get started:
      <ezpublish>/admin/setup/templateoperator

      Don't forget to check here first if it already exists what you need:
      http://ez.no/community/contribs/template_plugins
  • replacement operator?

    How do I do a simple replacement in a string?