Re: [SMARTY] Dynamic variables
| From: | Jason Sweat | Date: | Tue, 29 Apr 2003 12:12:23 +0000 |
| Subject: | Re: [SMARTY] Dynamic variables | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9415@lists.php.net to get a copy of this message | ||
From: "Raul Carvalho" <raul.carvalho@prisma.pt>
> for ($i=0;$i<N;$i++) {
> $var = "sel_$i";
> $smarty->assign($var, $$var);
> }
>
> How do I use these variables in a section or foreach loop?
Pass them in a way that is more usable by smarty:
$sel = array();
for ($i=0;$i<N;$i++) {
$var = "sel_$i";
$sel[] = $$var;
}
$smarty->assign('sel', $sel);