2010-02-08 8 views
0

Je veux ajouter une nouvelle ligne après quatre boucles. J'utilise {section loop = $ arrProducts name = index} quand execute array montrera tous les produits dans une ligne mais je veux ajouter tous les quatre produits en ligne. Que puis-je faire???Comment ajouter une nouvelle ligne après quatre boucles dans des modèles smarty

Merci ce code j'utilise

{if $arrProducts neq " "} 
{section loop=$arrProducts name=index} 
<td width="565" align="center" valign="top"> 

<img src="admin/{$arrProducts[index].image}" width="121" height="90" class="prodImg"/><br> 
<span class="prodName">{$arrProducts[index].name}</span><br> 
<span class="prodPrice">{$arrProducts[index].price}&nbsp;LE</span><br> 
<font class="quality">QTY.</font><input type="text" name="txtorder" size="1" class="txtproduct" /><font class="quality">&nbsp;Kg</font><br /> 
</td> 
{/section} 
{/if} 

Répondre

0

J'ai toujours utilisé le calcul Smarty pour voir si je dois ajouter une nouvelle ligne. Il pourrait ressembler à ceci:

{if $arrProducts neq " "} 
<tr> 
{section loop=$arrProducts name=index} 
{if $index % 4 == 0} 
</tr><tr> 
{/if} 
<td width="565" align="center" valign="top"> 

    <img src="admin/{$arrProducts[index].image}" width="121" height="90" class="prodImg"/><br> 
    <span class="prodName">{$arrProducts[index].name}</span><br> 
    <span class="prodPrice">{$arrProducts[index].price}&nbsp;LE</span><br> 
    <font class="quality">QTY.</font><input type="text" name="txtorder" size="1" class="txtproduct" /><font class="quality">&nbsp;Kg</font><br /> 
</td> 
{/section} 
</tr> 
{/if} 
+0

merci mais votre code montrent tous les produits v align –

+0

Que voulez-vous dire? – Daff