09/02/2011, 17:44:34
Citation :@iteration
iteration contains the current loop iteration and always starts at one, unlike index. It is incremented by one on each iteration.
Example 7.36. iteration example: is div by
The "is div by" operator can be used to detect a specific iteration. Here we bold-face the name every 4th iteration.
{foreach $myNames as $name}
{if $name@iteration is div by 4}
<b>{$name}</b>
{/if}
{$name}
{/foreach}
Example 7.37. iteration example: is even/odd by
The "is even by" and "is odd by" operators can be used to alternate something every so many iterations. Choosing between even or odd rotates which one starts. Here we switch the font color every 3rd iteration.
{foreach $myNames as $name}
{if $name@iteration is even by 3}
<span style="color: #000">{$name}</span>
{else}
<span style="color: #eee">{$name}</span>
{/if}
{/foreach}
This will output something similar to this:
<span style="color: #000">...</span>
<span style="color: #000">...</span>
<span style="color: #000">...</span>
<span style="color: #eee">...</span>
<span style="color: #eee">...</span>
<span style="color: #eee">...</span>
<span style="color: #000">...</span>
<span style="color: #000">...</span>
<span style="color: #000">...</span>
<span style="color: #eee">...</span>
<span style="color: #eee">...</span>
<span style="color: #eee">...</span>
...
je me trompe peu être (c'est possible comme je l'ai dis, je débute), mais visiblement dans cette explication tu as ce qu'il faut, l'iteration permet de grouper tes items par nombre (4) et de donner une directive à la suite du quatrième, te reste juste à trouver la bonne directive à donner suite à chaque groupe de 4 images
ps : en y regardant de + prés la solution de bess doit être plus propre et fonctionnelle

ps 2 : peut être un début de solution ici aussi : http://www.lotsofcode.com/php/smarty-pagination.htm , mais je ne veux pas t'embrouiller, je me met à ta place et j'essaye de trouver une solution
