Re: Smarty like .index .iteration .first .last .total in #for #repeat and #while

[email protected]
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
In smarty (directly from the documentation):
*index* contains the current array index, starting with zero
*iteration* contains the current loop iteration and always starts at one,
unlike *index*<http://www.smarty.net/manual/en/language.function.foreach.php#foreach.property.index>.
It is incremented by one on each iteration.
*first* is TRUE if the current {foreach} iteration is the initial one.
*last* is set to TRUE if the current {foreach} iteration is the final one.
*total* contains the number of iterations that this {foreach} will loop.
This can be used inside or after the {foreach}.


On 6/2/09, R. Tyler Ballance <[email protected]> wrote:
>
> On Tue, Jun 02, 2009 at 07:44:17AM +0200, Malix wrote:
> >    Does Cheetah has internal counter like those present in Smarty? They
> are
> >    very useful when you need to print a line number or made logic on
> that. I
> >    know that I can use a #set $counter, but internal variable are cool.
>
>
> Short answer, no. #for and #while map directly to their Python
> equivalents. Long answer, noooooooooo ;)
>
> WHy doy ou need them?
>
>
>
> --
> -R. Tyler Ballance
> Slide, Inc.
>
>
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> looking to deploy the next generation of Solaris that includes the latest
> innovations from Sun and the OpenSource community. Download a copy and
> enjoy capabilities such as Networking, Storage and Virtualization.
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>
>
>


-- 
Bidegg worlds best auction site
http://bidegg.com

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.