ez.no / exponential / documentation / reference / template functions / variables / set-block
{set-block [name=value1] scope=[global|root|relative] variable=value2}
...tpl code
{/set-block}
| Name | Type | Description | Required |
|---|---|---|---|
| name | string | Name of namespace | no |
| scope | Scope of name | yes | |
| variable | string | Name of variable to return | yes |
Function will render the output of the block into the variable
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.
name
Defines the name of the namespace of the returned variable
scope
The scope parameter can be global, root or relative:
variable
Define the name of the variable to place the output into
example
This example will insert the output of the block into the variable 'text'
{set-block name=MyNameSpace scope=global variable=text} some content to insert into my variable 'text' {/set-block} output:<br/> {$MyNameSpace:text
Log in or create a user account to comment.
Comments