Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

SMARTY show ODD and EVEN items with a SMARTY LOOP

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
erunways
Smarty n00b


Joined: 16 Nov 2009
Posts: 3

PostPosted: Tue Nov 17, 2009 9:47 pm    Post subject: SMARTY show ODD and EVEN items with a SMARTY LOOP Reply with quote

Here is an example of how to use SMARTY LOOP to show even and odd items. This could be modified to do much more but it is supposed to serve as a simple example. The variable $smarty.section.c_list.index is the real key which is variable that keeps track of the loop counter. Here you can find a demonstration of what the script does erunwaysDOTcom/smarty-show-odd-and-even-items-with-a-smarty-loop/
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Nov 17, 2009 10:50 pm    Post subject: Reply with quote

There is an easier syntax built in:

Code:
{if $smarty.foreach.foo.index is even}
...
{/if}
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP