Re: [SMARTY] alphabetically down columns in a table
| From: | Abdul-Wahid Paterson | Date: | Tue, 11 Jan 2005 16:03:55 +0000 |
| Subject: | Re: [SMARTY] alphabetically down columns in a table | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12147@lists.php.net to get a copy of this message | ||
Hi,
Ok, I came up with this solution which works fine for me. Thanks to
all who gave help with this and the array counting part.
I basically have an array called $data and a $numcols,....That in my
case my users are defining within their template.
Here is my template...cut down a bit to simplifiy the example
<table>
{math equation="count/$numcols" count=$data|@count assign=length}
{section name=data1 loop=$data step=$numcols}
<tr>
{section name=data2 loop=$data step=$length
start=$smarty.section.data1.iteration}
<td><a
href="sompage.php?data={$data[data2].foo|urlencode}">{$data[data2].bar}</a></td>
{/section}
</tr>
{/section}
</table>
In this why the PHP can generate one array of $data. The template can
decide whether to display it in a conventional row by row or this
column by column data. All with no extra stuff set on the PHP side.
Regards,
Abdul-Wahid