{set-block variable=$variable [ name=name ] [ scope=scope ]} ... {/set-block}
Name | Type | Description | Required |
---|---|---|---|
variable | string | The name of the variable (with dollar sign). | Yes. |
name | string | The name of the target namespace. | No. |
scope | string | The scope ("global", "root" or "relative"). | No. |
This mechanism will silently process all template code which is encapsulated by "{set-block ...}" and "{/set-block}". It will not produce any actual output. Instead, the generated output will be assigned to a variable specified by the "variable" parameter (as a string). If the variable does not exist, it will be automatically created. If the same target variable is used in several blocks, its contents will be overwritten every time a new block is processed.
{set-block variable=$example} {def $test=array( 'x', 'y', 'z' )} Hello world - {$test[1]} {/set-block} ... {$example}
The code which is encapsulated by "set-block" will not produce any output. Instead, the output will be put into a string called $example. When this variable is accessed directly, the following output will be produced: "Hello world - y".
{set-block scope=root variable=cache_ttl}0{/set-block}
This will put zero into the "cache_ttl" global variable and thus disable view caching for this page.
Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.