Re: [SMARTY] Loop?
| From: | Nichlas Löfdahl | Date: | Sat, 01 Mar 2003 22:18:08 +0000 |
| Subject: | Re: [SMARTY] Loop? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8324@lists.php.net to get a copy of this message | ||
Hello!
{section name=loop start=1 loop=6}
{if $smarty.section.loop.index lt $skill}
this
{else}
that
{/if}
{/section}
Hope it helps
Nichlas
----- Original Message -----
From: "Tom Sommer" <webmaster@tsn.dk>
To: <smarty-general@lists.php.net>
Sent: Saturday, March 01, 2003 8:52 PM
Subject: [SMARTY] Loop?
> I have a var called $skill that has the value 4
>
> I need to loop from 1 to 5 and if the count is <= $skill I need to print
> something
>
> so bassically I need to do this
>
> <?php
> for($i = 1; $i <= 5; $i++)
> {
> if ($i <= $skill)
> echo "this";
> else
> echo "that";
>
> }
> ?>
>
> in smarty?
>
> I need to do this like section for foreach, but can't really get it to
> work.. anyone?
> --
> Tom Sommer, denmark
> www.tsn.dk - www.dreamcoder.dk
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php