SV: [SMARTY] For
| From: | Mattias Hallström | Date: | Fri, 21 Feb 2003 12:37:00 +0000 |
| Subject: | SV: [SMARTY] For | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8076@lists.php.net to get a copy of this message | ||
Thanks alot.
I didn't realise that loop could take an integer.
It solved this and one other problem I had =)
I have 6 small icons, depending on a grade I set some green and some
red.
The code you gave me sets the green, and this code sets the rest.
{section name=i loop=6 start=$num}
...
{/section}
//Mattias
-----Ursprungligt meddelande-----
Från: messju mohr [mailto:messju@lammfellpuschen.de]
Skickat: den 21 februari 2003 13:32
Till: Mattias Hallström
Kopia: smarty-general@lists.php.net
Ämne: Re: [SMARTY] For
On Fri, Feb 21, 2003 at 01:16:31PM +0100, Mattias Hallström wrote:
> Hi,
>
> Probably a pretty simple question.
> Smarty has got foreach and sections, but how do I "for($i=0; $i<6;
> $i++)" ?
>
> The number 6 is assigned to a simple variable.
{section name=i loop=$max}
...
{/section}
with $max being an integer. you do not have to have an
an array of values to use {section}
you can also supply start max and step. see:
http://smarty.php.net/manual/en/language.function.section.php
have fun
messju
> //Mattias