ul li for 4 partition
Code:
{assign var="productByLine" value = "4"}
{assign var="productLineTurn" value = "1"}
{assign var="tr" value = "true"}
{assign var="turns" value = "1"}
<table style="border: 1px solid #CCC;">
{foreach from=$upcomingEvent item=product name=products}
<!-- Start a new line -->
{if $tr eq "true"}
<tr>
{assign var="productLineTurn" value = "1"}
{assign var="tr" value = "false"}
{/if}
<td style="padding: 5px; border: 1px solid #CCC;">
{$productLineTurn}
</td>
<!-- In end of products array -->
{if $smarty.foreach.products.iteration == $products|@count}
{section name=boucle start=0 loop=$productByLine-$productLineTurn step=1}
<td style="padding: 5px; border: 1px solid #CCC; text-align: center; color: #AAA;">Empty</td>
{/section}
{/if}
{if $smarty.foreach.products.iteration is div by 4}
</tr>
{assign var="tr" value= "true"}
{/if}
{assign var="productLineTurn" value = $productLineTurn+1}
{assign var="turns" value = $turns+1}
{/foreach}
</table>
Output:
1 2 3 4
5 6 7 8
{assign var="productByLine" value = "4"}
{assign var="productLineTurn" value = "1"}
{assign var="tr" value = "true"}
{assign var="turns" value = "1"}
<table style="border: 1px solid #CCC;">
{foreach from=$upcomingEvent item=product name=products}
<!-- Start a new line -->
{if $tr eq "true"}
<tr>
{assign var="productLineTurn" value = "1"}
{assign var="tr" value = "false"}
{/if}
<td style="padding: 5px; border: 1px solid #CCC;">
{$productLineTurn}
</td>
<!-- In end of products array -->
{if $smarty.foreach.products.iteration == $products|@count}
{section name=boucle start=0 loop=$productByLine-$productLineTurn step=1}
<td style="padding: 5px; border: 1px solid #CCC; text-align: center; color: #AAA;">Empty</td>
{/section}
{/if}
{if $smarty.foreach.products.iteration is div by 4}
</tr>
{assign var="tr" value= "true"}
{/if}
{assign var="productLineTurn" value = $productLineTurn+1}
{assign var="turns" value = $turns+1}
{/foreach}
</table>
Output:
1 2 3 4
5 6 7 8
Comments
Post a Comment