RE: I need some help please...(or I kill the cat!)
| From: | Monte Ohrt | Date: | Tue, 05 Jun 2001 19:18:54 +0000 |
| Subject: | RE: I need some help please...(or I kill the cat!) | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-867@lists.php.net to get a copy of this message | ||
You could use %item.first% instead of %item.index%
Also, looking at the data content, you wouldn't want an {else}, you
would want to show the votes on every loop.
{section name=item loop=$result}
{if %item.first%}
{$result[item].votes} people voted for {$result[item].title}
{/if}
{$result[item].text} : {$result[item].votes} votes
{/section}
Mike Krus wrote:
>
> Hi,
>
> Alain Fontaine wrote:
>
> > The result might be :
> >
> > $result[0]["votes"] people voted for $result[0]["title"]
> > --------
> > $result[1]["text"] : $result[1]["votes"] votes
> > [...]
> > $result[n]["text"] : $result[n]["votes"] votes
> this should work:
>
> {section name=item loop=$result}
> {if %item.index% eq 0}
> {$result[item].votes} people voted for {$result[item].title}
> {else}
> {$result[item].text} : {$result[item].votes} votes
> {/if}
> {/section}
>
> Mike
>
> PS: and keep your hands off that cat !!
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/