• News
  • Developer information
  • Projects & contributions
  • Forum
  • Issue tracker
  • Open Funding
  • Security
  • User groups
  • Support
  • Store
  • Company

  • Path

    ez.no / exponential / documentation / development / libraries / ez template / operators / miscellaneous


    Miscellaneous

    These documentation pages are no longer maintained. Please visit the new documentation site.

    Unit operators

    si

    Handles unit display of values, most often used for showing sizes of files but can also be used for displaying units on other items such as meters, grams etc.
    The operator reads two parameters. The first tells the kind of unit type we're dealing with, for instance: byte, length.
    The second determines the behaviour of prefixes and is optional.

    {1025|si(byte)}
    
     {1025|si(byte,binary)}
    
     {1025|si(byte,decimal)}
    
     {1025|si(byte,none)}
    
     {1025|si(byte,auto)}
    
     {1025|si(byte,mebi)}

    This is a complete list of all the operators you can use in Exponential templates. Most operators are native to eZ template (general), some are specific for Exponential.

    Locale

    l10n

    Localizes values, e.g.

    {42.50|l10n(currency)}

    Allowed types are: datetime, shortdatetime, time, shorttime, date, shortdate, currency or number.

    Dates

    datetime

    Formats dates and times according to formats defined in datetime.ini. Custom formats in the template itself are also possible. E.g.

    {$date|datetime(mydate)}, {$date|datetime(custom,"%m %y")}

    currentdate

    Returns the timestamp of the current datetime. E.g.

    {currentdate()}

    Debug

    attribute

    Helper attribute to print available methods in objects and arrays, by default it only shows the array keys and object
    attribute names but by passing show as parameter it will fetch the values.
    The second parameter can be used to controlled the number of children to expand, default is no limit which may give problems with values that loop. The returned result is an HTML table unless false() is passed as the third parameter. E.g.

    {$node|attribute(show)}, {$node|attribute(show,2,false)}

    Output washing

    wash

    General character/string washing operator. The washing type is the first parameter:

    • xhtml (default) replaces special HTML characters
    • email replaces '@' and '.' with '_at_' and '_dot_', as specified in template.ini
    • pdf replaces whitespace characters in postscript codes

    Text operations

    concat

    Concatenates values to one string. If you give it an array, it will concatenate the elements of the array. E.g.

    {concat('/var/',$node.node_id,'/')}

    autolink

    Converts all known links in a text to links that can be clicked. E.g.

    {"Some links: ftp://ftp.mysite.com me@mysite.com http://www.mysite.com"|autolink}

    ezini

    The ezini() operator enables access to the variables in the *.ini files. It takes three arguments:

    • a section in the ini file (as put between [] brackets)
    • the variable itself
    • optional: the .ini file, if other than site.ini
    {ezini('[section]','[variable]','[ini file]')}

    For example to differentiate between locale settings, use template code similar to the follwing:

    {section show=eq(ezini('RegionalSettings','Locale'),"eng-GB")}
    
    ... display por-PT link
    
    {section-else}
    
    ... display eng-GB link
    
    {/section}

    Exponential kernel operators

    ezurl

    Makes sure that the url works for both virtual hosts and non-virtual host setups.

    ezroot

    he last parameter value. E.g.

    {and(false(),false(),true(),false())}

    returns false.

    choose

    Uses the input count to pick one of the parameter elements. The input count equals the parameter index. E.g.

    {0|choose("a","b","c")} returns "a".

    contains

    Returns true if the first parameter value is found in the input value, which must be an array.
    Currently it works the same way as the PHP function in_array() but it may later be extended to support more advanced matching. E.g.

    $array|contains($myvalue)

    Comments

    Dates from Attributes

    If you need to access the date of a "ezdate" attribute, you must use
    {$node.object.data_map.datum.data_int} to get the unix timestamp ("datum" is the attribute identifier)
    Of course, you don't want to print the timestamp, so do something like this:
    {$node.object.data_map.datum.data_int|l10n(shortdate)}
    to get a nice, localized daten print.

    ezurl and related types

    may take one additional argument dor defining the quotes. Values are 'no' and 'single'. Doubles quotes are default

    {'content/view/full/2'|ezurl('single')} -> 'index.php/content/view/full/2'

    more types

    > Allowed types are: time, shorttime, date, shortdate, currency or number.

    + datetime

    others?

    Contents

    Development

    Extensions
    Exponential datamodel
    Exponential tuning and stability
    Importing attribute data
    Kernel
    Libraries
        eZ xml
        eZ db
        eZ i18n
        eZ soap
        eZ template
           Basics
           Functions
           Operators
              Data fetch
              String handling
              Type handling
              Logical handling
              Arithmetics
              Control structure handling
              Array handling
              Image handling
              Miscellaneous
        eZ webdav
    Scripting
    Standards
    System overview
    Test Suite
    Using Doxygen to create API documenta...


    Created

    07/07/2003
    3:33:54 pm
    by Bård Farstad

    Last updated

    31/01/2004
    1:21:19 am
    by Harry Oosterveen

    Authors

    Bård Farstad
    Jan Borsodi
    liu spider
    Harry Oosterveen



    This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.