|
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 |
migas Smarty Regular
Joined: 07 Apr 2004 Posts: 73 Location: Porto, Portugal
|
Posted: Wed Apr 07, 2004 2:36 am Post subject: {section} every x |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Apr 07, 2004 1:52 pm Post subject: |
|
|
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 |
|
migas Smarty Regular
Joined: 07 Apr 2004 Posts: 73 Location: Porto, Portugal
|
Posted: Wed Apr 07, 2004 3:30 pm Post subject: sorry |
|
|
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 |
|
migas Smarty Regular
Joined: 07 Apr 2004 Posts: 73 Location: Porto, Portugal
|
Posted: Wed Apr 07, 2004 3:41 pm Post subject: |
|
|
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 |
|
|
|
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
|