how do [iteration - 1] in template?

From: Date: Sun, 21 Mar 2004 16:25:24 +0000
Subject: how do [iteration - 1] in template?
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11154@lists.php.net to get a copy of this message
Hello Smarties, I would like to use "iteration - 1" as an index in an array: {foreach name=val key=key item=Val from=$Row} {if $ColNames[$smarty.foreach.val.iteration - 1] eq $PkNames[$smarty.foreach.val.iteration - 1]} {$Val} (*) {else} {$Val} {/if} {/foreach} This generates: Fatal error: Smarty error: [in index.tpl line 15]: syntax error: $smarty. is an unknown reference (Smarty_Compiler.class.php, line 2031) in C:\PHP\lib\Smarty\Smarty.class.php on line 1102 It works fine if I remove "- 1", or if I print it like so: {$smarty.foreach.val.iteration - 1} (Smarty 2.6.2) I'm stuck Kalle

« previous php.smarty.general (#11154) next »