Re: [SMARTY-DEV] {counter} bug

From: Date: Sun, 08 Jun 2003 01:34:07 +0000
Subject: Re: [SMARTY-DEV] {counter} bug
References: 1 2 3 4 5 6  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1545@lists.php.net to get a copy of this message
On Tue, Jun 03, 2003 at 06:53:59PM +0400, Konstantin A. Pelepelin wrote: > On Tue, 3 Jun 2003 15:23:30 +0200, Messju Mohr <messju@lammfellpuschen.de> > wrote: > > >>Code: > >>|{{counter name=c1 assign=index start=0 print=true}}<br> > >>{{$index}}:{{counter name=c1}}:{{$index}} <br> > >>{{$index}}:{{counter name=c1}}:{{$index}} <br> > > > >>For c1 print=true should be ignored since 'assign' is used. > >>'start' value is not reset in 2nd block. > > >i agree, that start=0 should reset the counter, but why should the > >value not be printet if you say {counter print=true} ? > > Docs say "assigned instead of being output", and that is how it works in > 2.5.0. > I think, it should work as > > |0 > > 0:1:1 > > 1:2:2 > > Since it remembers 'assign', it should remember 'print', and need to > correct docs. > But then it will not be compatible with 2.5.0 (and earlier, I think) i don't think it should remember 'print'. 'print' is mostly for initialisation. for example: {counter start=2 print=false} {section ...} {counter} {/section} it's not nice to have to say print=true afterwards, IMHO. on the other hand {counter} IMHO *should* remember 'assign'. when i assign the counter-value to a variable, it is very likely that i want to assign it to the same variable on the next call to {counter} the docs should say now: print: Type: boolean Required: No Default: false if assign is set, true otherwise Description: Whether or not to print the value assign: Type: string Required: No Default: n/a Description: the template variable the output will be assigned to. this value will be remembered and reused on subsequent calls to {counter} that's how current cvs's counter works. an alternative would be to *not* remember 'assign'. this would simplify things a lot, but with having to repeat 'assign=...' on every use of the counter as a drawback.. thoughts anyone? greetings messju > WBR, > Konstantin A. Pelepelin

« previous php.smarty.dev (#1545) next »