Re: looping two different arrays in one section.
| From: | Monte Ohrt | Date: | Tue, 03 Apr 2001 15:18:58 +0000 |
| Subject: | Re: looping two different arrays in one section. | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-510@lists.php.net to get a copy of this message | ||
$smarty->assign("flikar",array("One", "Two", "Three"));
$smarty->assign("typ",array("on", "off", "passive"));
{section name=mystuff loop=$flikar}
current flikar: {$mystuff/flikar}
current typ: {$mystuff/typ}
{/section}
tomas@altern.org wrote:
>
> Hi!
>
> This mighht be a stupid question (but where I come from there are now stupid questions), so I
> guess not.
>
> Enough with the babbling, and to the matter.
>
> I have to arrays:
> $flikar = array("One", "Two", "Three")
> $typ = array("on", "off", "passive");
>
> What I would like to do is to:
> in a section where I loop over the $flikar-array (to extract the names I would also like to get
> the value of the corresponding index in $typ. So when I get the value "Two" (which is
> $flikar[1]) I would also want to get the value "off" (which is $typ[1])
>
> Restrictions to the solution:
> I can't use an associative array since I don't know the names that are going into
> $flikar until runtime (in some cases theese values will be a range of dates taken from a
> databse-tables start_date-value and end_date-value)
>
> Ok, enough is enough, if you don't get me ask me to clarify.
>
> thanks,
> tomas
>
> ---
> 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/