|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
erunways Smarty n00b
Joined: 16 Nov 2009 Posts: 3
|
Posted: Tue Nov 17, 2009 9:47 pm Post subject: SMARTY show ODD and EVEN items with a SMARTY LOOP |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 17, 2009 10:50 pm Post subject: |
|
|
There is an easier syntax built in:
Code: | {if $smarty.foreach.foo.index is even}
...
{/if} |
|
|
Back to top |
|
|
|
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
|