|
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 |
rschlege Smarty n00b
Joined: 21 Apr 2003 Posts: 2
|
Posted: Mon Apr 21, 2003 2:49 pm Post subject: {[b]section[/b] name='' loop=''} |
|
|
I'd like to generate a two-dimensional table. Therfore it would be useful to do something with the modulo-operator (%) like this:
<table><tr>
{section name=items_id loop=$items}
<td>
This is {$items[items_id]}
</td>
{if $items_id%5 == 0}
</tr>
<tr>
{/if}
{/section}
</tr></table>
Can someone show me how it is be done the easiest way?
Roman |
|
Back to top |
|
rschlege Smarty n00b
Joined: 21 Apr 2003 Posts: 2
|
Posted: Mon Apr 21, 2003 3:19 pm Post subject: two-dimensional table |
|
|
Sorry for the rash question... it was easier than I expected:
<table><tr>
{section name=items_id loop=$items}
<td>
This is {$items[items_id]}
</td>
{if $smarty.section.items_id.index%5 == 0}
</tr>
<tr>
{/if}
{/section}
</table>
Greez
Roman |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Apr 21, 2003 8:06 pm Post subject: |
|
|
Or, use the intuitive Smarty syntax
{if $smarty.section.foo.index is div by 5}
...
{/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
|