This is the old documentation center for eZ Publish 4. We are currently migrating the eZ Publish documentation to http://confluence.ez.no the eZ Publish 5 documentation platform. Documentation for the eZ Publish legacy components are still located on this site, as well as all documentation for earlier releases.

run-once

Summary

Assures that a block of template code is run only once within a page view.

Usage

{run-once}
    ...
{/run-once}

Description

This function makes sure that a block of template code is processed only once within a page view. It is typically useful when it comes to displaying elements that should appear once or to do timeconsuming calculations that only has to be processed once (and the result is included in multiple templates).

Examples

Example 1

{def $elements=array( 'A', 'B', 'C' )}
 
{foreach $elements as $element}
 
    {run-once}
        Hello world <br/>
    {/run-once}
 
    {$element} <br />
 
{/foreach}

The following output will be produced:

Hello World
A
B
C

Balazs Halasy (06/02/2004 2:20 pm)

Balazs Halasy (28/04/2005 4:00 pm)


Comments

There are no comments.