Exactement. Bon, je ne dis pas que c’est incroyable niveau design, mais c’est la fonctionnalité qui est intéressante...
Pour détailler, voici l’appel de Ditto :
<table bgcolor="#F7F7FF" border="0" cellspacing="10">
[[Ditto? &parents=`[*id*]` &display=`all` &sortDir=`ASC` &sortBy=`menuindex` &tpl=`tpl_tableau_titre_image` &showPublishedOnly=`1`]]
</table>
Et voici le template correspondant :
[+ditto_iteration:modulo=`3`:is=`2`:then=`<tr>`+]
<td valign="middle" align="center" width="180" border="3" bgcolor="#CED2EE" ><br><a href="[~[+id+]~]"><img src="[+image_document+]" width="120" height="120"/></a><br><a href="[~[+id+]~]">[+pagetitle+]</a><br><br></td>
[+ditto_iteration:modulo=`3`:is=`1`:then=`</tr>`+]
Pour rappel, il faut avoir installé PHx et ajouter le snippet suivant pour que ça marche : phx:modulo
<?php
/**
* [+ditto_iteration:modulo=`n($options)`:is=`1`:then=`Le résultat`+]
*/
if ( ( (int)$output + 1 ) % (int)$options === 0 )
{
return 1;
}
else
{
return 0;
}
?>