Re: [SMARTY] table sections
| From: | Monte Ohrt | Date: | Tue, 07 May 2002 13:56:09 +0000 |
| Subject: | Re: [SMARTY] table sections | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4069@lists.php.net to get a copy of this message | ||
There is an error in the below example, it should read:
{math equation="ceil(total / cols)" cols=2 total=$var|@count
assign="col_total"}
where $var is the array of values being looped through.
Monte
Monte Ohrt wrote:
Do the links a,b,c need to be in separate table cells? If not, you could do it like this: {* figure out how many elements per column, assign to $col_total *} {math equation="ceil(total / cols)" cols=2 total=$var assign="col_total"} <tr> <td> {section name=foo loop=$var}-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.$var[foo]<br>{if not $smarty.section.foo.last and $smarty.section.foo.iteration is div by $col_total}{* start next column *} </td><td>{/if} {/section} </td> </tr> Arleen Sáles wrote:i've done research and found similar examples and even a table function provided peter bowyer, however, i'd like to achieve the result using sections. if a solution has already been posted to this question, could you please direct me to it? i just want to display my links from a database query in table format this way:link a link d link b link e link c link fthank you in advance. arleen.