Monday 27 January 2003 12:23:43 pm
> Is it possible to modify values of variables? E.g.
>
> {let i=1}
> {section loop=10}
> {let i=sum($i,1)} > {/section}
Yes, however you need to use set to modify existing variables.
{let i=1}
{section loop=10}
{set i=sum($i,1)}
{/section} {/let} You also need an ending let which will unset the variable (same with default).
> or just
>
> {let x=10} > {let x=$x + 20}
The template engine does not have specialized arithmetic operators built in like other engines, instead it relies on custom template to do the work. The template behaves much like LISP (Used in Emacs for instance), ie. the operator is written before the operands.
x=1+2+3+4+5+6 {set x=sum(1,2,3,4,5,6)}
y=a*x+b {set y=sum(mul($a,$x),$b)}
{set a=sum(and($b,$c,$d),or($e,$f,$g))} The and will return $d if all input are "true" and the or will return the first that is "true".
--
Amos
Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq
|