|
This is a simple guide to get Smarty setup and running quickly. The online
documentation includes a very thorough explanation of a Smarty installation.
This guide is meant to be a quick and painless way of getting Smarty working,
and nothing more. The guide assumes you are familiar with the UNIX system
environment. Windows users will need to make adjustments where necessary.
http://www.smarty.net/quick_start.php
Comments (0) 19.04.2008. 13:46 Simple Solution for any number of columns
This is for any number of columns, and its short and painless:
{assign var="cols" value="4"} {* change here for coumns count *}
{* $cols is the number of columns you want *}
<TABLE border=1>
<TR>
{section name=numloop loop=$data}
<TD>{$data[numloop]}</TD>
{* see if we should go to the next row *}
{if not ($smarty.section.numloop.rownum mod $cols)}
{if not $smarty.section.numloop.last}
</TR><TR>
{/if}
{/if}
{if $smarty.section.numloop.last}
{* pad the cells not yet created *}
{math equation = "n - a % n" n=$cols a=$data|@count assign="cells"}
{if $cells ne $cols}
{section name=pad loop=$cells}
<TD> </TD>
{/section}
{/if}
</TR>
{/if}
{/section}
</TABLE>
Comments (0) 16.04.2008. 18:36 |