Re: [SMARTY] assing the returned value of cycle.
| From: | Peter Rotich | Date: | Thu, 24 Jul 2003 18:00:40 +0000 |
| Subject: | Re: [SMARTY] assing the returned value of cycle. | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9960@lists.php.net to get a copy of this message | ||
On Thu July 24 2003 09:44 am, Florian Winkler wrote:
> Hi All ;) ,
>
> the code which doesn't work how I want it to work is here :
>
> {section name=i loop=$daten}
> {cycle values="#DFDFDF,#CECECE" assign=$bgcolor}
>
> <td bgcolor="{$bgcolor}">hello</td>
>
> {/section}
The code below should solve your problem. Assumming daten is an array.
{section name=i loop=$daten}
{cycle values="#DFDFDF,#CECECE" assign="row_color"}
<tr bgcolor="{$row_color}">
<td>{$daten[i].column1}</td>
<td>{$daten[i].column2}</td>
<td>{$daten[i].column2}</td>
</tr>
{/section}
Peter Rotich
--
"A likely impossibility is always preferable to an unconvincing possibility."
Aristotle, Green philosopher (384-322BC)