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

{section} every x

 
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
migas
Smarty Regular


Joined: 07 Apr 2004
Posts: 73
Location: Porto, Portugal

PostPosted: Wed Apr 07, 2004 2:36 am    Post subject: {section} every x Reply with quote

Hi,
is there any function in smarty or arg
that can make this happen

Like in {section}

EVERY x

Where 'x' must be an integer. It can consist of more than one digit. This variable is true if number of current pass modulo 'x' equals to zero. The variable is never true in first or last pass, even if the condition above is true in such a pass. This variable can be used to put separators between every 'x' items of a list.

Thanks
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Apr 07, 2004 1:52 pm    Post subject: Reply with quote

like this?

{section name="foo" loop=$myvar}

{if $smarty.section.foo.iteration is div by 4}
(do something every 4th iteration)
{/if}

{/section}
Back to top
View user's profile Send private message Visit poster's website
migas
Smarty Regular


Joined: 07 Apr 2004
Posts: 73
Location: Porto, Portugal

PostPosted: Wed Apr 07, 2004 3:30 pm    Post subject: sorry Reply with quote

Thanks, but sorry that doesn't doit

Example:
total = 12

1 2 3
table header
4 5 6 7
table header
8 9 10 11
table header
12

i just cant find a way to make this happen.
1 2 3 4
table header
5 6 7 8
table header
9 10 11 12
Back to top
View user's profile Send private message
migas
Smarty Regular


Joined: 07 Apr 2004
Posts: 73
Location: Porto, Portugal

PostPosted: Wed Apr 07, 2004 3:41 pm    Post subject: Reply with quote

Found the solution

Thanks you showed me the path.

{if $smarty.section.foo.index is div by 4}

table header
0 1 2 3
table header
4 5 6 7
table header
8 9 10 11
Back to top
View user's profile Send private message
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