Re: [SMARTY] counter bug ?

From: Date: Sun, 27 Apr 2003 18:31:02 +0000
Subject: Re: [SMARTY] counter bug ?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9393@lists.php.net to get a copy of this message
On Sun, Apr 27, 2003 at 05:20:22PM +0200, Nino Katic wrote: > Hi, > > I found smartys counter function working little strange. I'm using smarty > ver. 2.4.2 and this is the code inside template: > > {counter name="d" start=0 print=false} > > {foreach from=$page_protURL_vars item=stranica} > <a href="showtime.php?{$stranica}">{counter}</a> > {/foreach} > > {counter name="a" start=0 assign="a" print=false} > {counter name="c" start=0 print=true} > {counter name="b" start=0 assign="b" print=false} > > Counter named "c" will not print value 0, and if placed like so it will: > > {counter name="c" start=0 print=true} > {counter name="a" start=0 assign="a" print=false} > {counter name="b" start=0 assign="b" print=false} > > It will also not work if it's places last like this: > > {counter name="a" start=0 assign="a" print=false} > {counter name="b" start=0 assign="b" print=false} > {counter name="c" start=0 print=true} > > Why is this not working? because of a bug ;-) thanks for reporting this. it is fixed in the cvs version now. the problem occured when {counter} was used with and without the assign attribute in the same template. now i have a question (the documentation is unclear here): when i do {counter name="a" assign="a"} ({$a} is 1 now) ... {counter name="a"} should $a become 1 or 2? what i mean: should counter "remember" the assign attribute of the first call to counter, and assign the value to $a at the second call, even, when the assign is not given there? i can make i behave both ways. until today, it remembered the assign, but in a buggy way. now it doesn't remember the assign any more. any pros/cons for the one or the other??? greetings messju > Nino > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

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