Question about automatic assigning
| From: | Luc Saint-Elie | Date: | Fri, 27 Apr 2001 08:07:04 +0000 |
| Subject: | Question about automatic assigning | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-608@lists.php.net to get a copy of this message | ||
Hello,
Browsing throughout the list archives, I found the following question and
answer.
My question is : why is it impractical ? what kind of problems could arise if I
use this very appealing automatic assignment ?
Luc
Question :
> What do you think about the following idea:
>
> $variables = get_defined_vars();
> while (list ($key, $val) = each ($variables))
>
> $smarty->assign($key, $val);
> }
>
> Is something like that reasonable at all in order
> to not think about assigning? Before I even try
> I'd like to hear your opinion...
Answer :
========
> Be my guest :-) I don't think there is a need to
> do a loop though, you could just do this:
>$smarty->assign(get_defined_vars());
>This would never be done by default in Smarty,
>it is much too impractical.