let

Summary

Declares (and defines) a variable. Warns if variable exists.

Usage

{let [ name=namespace ] [ var1=value2 ] [var2=value3] [...] }
 ...tplcode
{/let}

Parameters

NameTypeDescriptionRequired
namespace string Namespace for all generated template variables no
value1 mixed Variable set to variable name no

Returns

Description

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.

Examples

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}

Comments

Log in or create a user account to comment.

Contents

Reference

Database diagram
Template operators
Template functions
    GUI
    Miscellaneous
    Program flow
    Variables
       append-block
       default
       let
       sequence
       set
       set-block
Data fetching
Modules
XML tags


Created

06/02/2004
2:23:06 pm
by Balazs Halasy

Last updated

25/02/2004
5:16:50 pm
by Vidar Langseid

Authors

Balazs Halasy
Vidar Langseid
K�re K�hler H�vik



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.