AW: [SMARTY] How can one create a table dynamically with Smarty ?
| From: | Ben | Date: | Fri, 30 Apr 2004 14:03:33 +0000 |
| Subject: | AW: [SMARTY] How can one create a table dynamically with Smarty ? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11339@lists.php.net to get a copy of this message | ||
You mean the code below would produce 2 Columns?
To span a table with my framework i just used this code
in my output-template
<table>
{section name=n loop=$data}
<tr>{foreach item=val from=$data[n]}
<td style="background-color:#{if
($smarty.section.n.iteration%2)==0}D9D9D9{else}FFFFFF{/if};">{if
!$val} {else}{$val}{/if}</td>
{/foreach}
</tr>
{/section}
</table>
in this case $data is an 2dimensional array, as you will get it when
reading
some rows from a database. each row is an array stored as element of
another
one so here.
The 1st dimension i walk through with the section, the second one with
the foreach, because its associative.
hth
Ben
-----Ursprüngliche Nachricht-----
Von: Pete [mailto:webmaster@dentona.de]
Gesendet: Freitag, 30. April 2004 15:50
An: smarty-general@lists.php.net
Betreff: Re: [SMARTY] How can one create a table dynamically with Smarty
?
Hi Gabriel,
thank you very much for the reply.
Unfortunately that doesn't help at all.
The problem is that a multi column table is needed.
The code below will only produce a table with one column.
<table>
{section loop=$data name=i}
<tr><td>{$data[i].image}</td><td>{$data[i].description}</td></tr>
{/section}
</table>
Thx anyway and have a nice weekend!!
Regards Pete
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---
__________________________________________________________
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.672 / Virus Database: 434 - Release Date: 28.04.2004
---
__________________________________________________________
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.672 / Virus Database: 434 - Release Date: 28.04.2004