• 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 / functions / function list


    Function list

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

    This is a complete list of all the functions you can use in Exponential templates. Some functions are native to the eZ template library (and can be used in other applications), while others are specific for eZ publish.

    Exponential template library functions

    section (delimiter, section-exclude, section-include, section-else)

    Used for looping over arrays and numeric ranges, and conditional control of block and sequences.
    Several input parameters and sub functions are available. Requires an end tag. More...

    ldelim

    Outputs the { sign (left curly bracket). Requires no end tag. More...

    rdelim

    Outputs the } sign (right curly bracket). Requires no end tag. More...

    include

    Includes another template file. Requires no end tag. More...

    switch (case)

    Allows conditional control of output. Requires an end tag. More...

    sequence

    Creates a sequence that can be iterated over, wrapping around to the beginning when the end is
    reached. Requires no end tag. More...

    let, default

    Assigns one or more variables within its tags. Requires an end tag. "default" assigns the variables
    unless they are already assigned, while "let" always assigns them. The assigned variables are freed
    (released) at the end tag.
    E.g.

    {let var1=42 var2='forty-two'}
    
    Variables: {$var1} ({$var2})
    
    {/let}

    This will output "Variables: 42 (forty-two)".

    {let var1=42 var2='forty-two'}
    
    {default var1=53}
    
    Variables: {$var1} ({$var2})
    
    {/default}
    
    {/let}

    This will output "Variables: 42 (forty-two)", because the first variable was set before the
    default statement.

    By passing name as a parameter all variables will be created in the new namespace:

    {let name=NewNameSpace ...}

    You can even use let to change the namespace by passing no assignments:

    {let name=First}
    
     {let name=Second}
    
     {/let}
    
    {/let}

    set

    Assigns a value to one or more variables. The value must have been created earlier using let
    or default. Requires no end tag.
    E.g.

    {let var=4}
    
    Before: {$var}
    
    {set var=42}
    
    After: {$var}
    
    {/let}

    This will output "Before: 4 After: 42".

    set-block

    Renders all it's children as text and sets it as a template variable. This is useful for allowing
    one template to return multiple text portions, for instance an email template could set subject as a
    block and return the rest as body. Requires an end tag.
    The scope parameter can be global, root or relative:
    global - Sets the variable in the defined subspace (if any) in the global namespace
    root - Sets the variable in the defined subspace in the root namespace of the current file
    (may be the same as global namespace in some cases)
    relative - Sets the variable in the defined subspace from the current namespace.
    E.g.

    {set-block name=MyNameSpace scope=global variable=text}
    
    {$item} - {$item2}
    
    {/set-block}

    This will render the output into the variable "text".

    append-block

    Similar to set-block but will create an array out of all appends instead. Requires an end tag.
    E.g.

    {append-block scope=global variable=extra_header_data}
    
     {* Add some code, for instance a java script *}
    
    {/append-block}

    Then, in a template, you could to this:

    {section loop=$#extra_header_data show=is_set($#extra_header_data)}
    
    {$:item}
    
    {/section}

    run-once

    Assures that the content of the block is run only once in a page view, it uses the current filename
    and placement to figure this out. This can be useful if you want a text to appear once or a calculation
    to be run once for included templates or loops. Requires an end tag.

    cache-block

    Caches the content of the block. It takes one or both of these two input parameters:

    • keys, which determines the cache key, and
    • expiry, which sets the expiry time in seconds.

    The cache key can be a simple value like a string or an integer, or an array of simple values. Requires an end tag.

    E.g.

    {cache-block keys=$node_id expiry=60}
    
    {* Do something that needs caching *}
    
    {/cache-block}

    Exponential kernel functions

    attribute_edit_gui

    Edit a content attribute. You must supply the attribute parameter. Any other parameters are passed
    on as template variables.

    E.g. {attribute_edit_gui attribute=$myAttribute}

    attribute_view_gui

    Show a content attribute. You must supply the attribute parameter. Any other parameters are passed
    on as template variables.
    E.g.

    {attribute_view_gui attribute=$myAttribute}

    class_attribute_edit_gui

    Edit an class attribute, this is used when editing classes. You must supply the class_attribute
    parameter. Any other parameters are passed on as template variables.
    E.g.

    {class_attribute_edit_gui class_attribute=$myAttribute}

    content_view_gui

    Show a content object. You must supply the content_object parameter. The view parameter, specifying
    which view mode to use, is optional. Any other parameters are passed on as template variables.
    E.g.

    {content_view_gui view=text_linked content_object=$myObject}

    content_version_view_gui

    Show a content object version. You must supply the content_version parameter. The view parameter,
    specifying which view mode to use, is optional. Any other parameters are passed on as template
    variables.
    E.g.

    {content_version_view_gui view=full content_version=$myContentVersion}

    collaboration_view_gui

    Show a collaboration item. You must supply the item_class and collaboration_item parameters.
    The view parameter, specifying which view mode to use, is optional. Any other parameters are passed
    on as template variables.
    E.g.

    {collaboration_view_gui view=line item_class=$myCollaborationItemClass
    
    collaboration_item=$myCollaborationItem}

    collaboration_icon

    Show the icon for a collaboration item. You must supply the collaboration_item parameter.
    The view parameter, specifying which view mode to use, is optional. Any other parameters are passed
    on as template variables.
    E.g.

    {collaboration_icon view=small collaboration_item=$myCollaborationItem}

    collaboration_simple_message_view

    Show a collaboration message. You must supply the sequence, is_read, item_link and
    collaboration_message parameters. The view parameter, specifying which view mode to use, is optional.
    Any other parameters are passed on as template variables.
    E.g.

    {collaboration_simple_message_view
    
    view=element
    
    sequence=$:sequence
    
    is_read=$current_participant.last_read|gt($:item.modified)
    
    item_link=$:item
    
    collaboration_message=$:item.simple_message}

    collaboration_participation_view

    Show a collaboration participation. You must supply the collaboration_participant parameter.
    The view parameter, specifying which view mode to use, is optional. Any other parameters are passed
    on as template variables.
    E.g.

    {collaboration_participation_view
    
     view=text_linked collaboration_participant=$:item}

    event_edit_gui

    Edit an event, this is used in the workflow edit form. You must supply the event parameter. Any
    other parameters are passed on as template variables.
    E.g.

    {event_edit_gui event=$myEvent}

    node_view_gui

    Show a node. You must supply the content_node parameter. The view parameter, specifying which view
    mode to use, is optional. Any other parameters are passed on as template variables.
    E.g.

    {node_view_gui view=full content_node=$myNode}

    shop_account_view_gui

    Show a shop account. You must supply the order parameter. The view parameter, specifying
    which view mode to use, is optional. Any other parameters are passed on as template variables.
    E.g.

    {shop_account_view_gui view=html order=$myOrder}

    Comments

    attribute_edit_gui question

    {attribute_edit_gui...} presents the current attribute value in an edit field. How do you save the attribute that the user has changed?

    Set multiple variables

    This doc tells that set assigns a value to one or more variables. I thought {set a=1 b=2} should work, but it does not in my site (3.3-4). I found that {set a=1}{set b=2} works fine in case others are struggeling with the same issue.

    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
              Function list
              Section
              Sequence
              Delimiter
              Switch
              Include
           Operators
        eZ webdav
    Scripting
    Standards
    System overview
    Test Suite
    Using Doxygen to create API documenta...


    Created

    07/07/2003
    3:22:04 pm
    by Bård Farstad

    Last updated

    16/09/2003
    1:08:29 pm
    by Gunnstein Lye

    Authors

    Bård Farstad
    Paul Borgermans
    Gunnstein Lye



    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.