ez.no / exponential / documentation / reference / template functions / variables / let
{let [ name=namespace ] [ var1=value2 ] [var2=value3] [...] }
...tplcode
{/let}
| Name | Type | Description | Required |
|---|---|---|---|
| namespace | string | Namespace for all generated template variables | no |
| value1 | mixed | Variable set to variable name | no |
Assigns one or more variables within its tags. The assigned variables are freed
(released) at the end tag.
name
By passing name as a parameter all variables will be created in the new namespace.
example
Two variales is set in this example, one string and one array.
{let var1='my test' var2=array( 'element1', 'element2', 'element3' )} var1 : {$var1}<br/> elements in var2 :<br/> {section var=element loop=$var2} {$element}<br/> {/section} {/let}
example
In this example we change namespace but passing no assignments
{let name=First} {let name=Second} {/let} {/let}
example
Here we create a new namespace and then use a variable defined in this namespace
{let name=First} {let var1='Mystring'} variable : {$First:var1}<br/> {/let} {/let}
Log in or create a user account to comment.
Comments