Re: [SMARTY-DEV] rë: CVS commit fixes couple things
| From: | Monte Ohrt | Date: | Thu, 27 Feb 2003 19:43:24 +0000 |
| Subject: | Re: [SMARTY-DEV] rë: CVS commit fixes couple things | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-860@lists.php.net to get a copy of this message | ||
Yes, that should work. Let me know if it doesn't.
my test:
{$smarty.cookies.$foo.blah}
<?php echo
$GLOBALS['HTTP_COOKIE_VARS'][$this->_tpl_vars['foo']]['blah'];
?>
On Thu, 2003-02-27 at 13:36, Gerard wrote:
> Is it possible to access variables like:
>
> {$smarty.cookies.$cookies.username}
>
> where $cookies is another assoc array (with key 'username')?
>
> Gerard
>
>
> >>>>>>>>>>>>>>>>>
>
> I committed to CVS some changes. First off, any smarty var can be
> dynamic:
>
> $smarty.get.$foo
> $smarty.post.$foo
> $smarty.section.$foo.$bar <-- even section names!
> $smarty.const.$foo
> $smarty.config.$foo
> etc.....
>
> Also for embedding variables in quotes, there has been an ongoing
> problem with variable ambiguity:
>
> {include file="$smarty.section.foo.bar.tpl"}
>
> ".tpl" is NOT part of the var, but it gets treated that way.
>
> At first I tried using only the first three segments of the smarty var,
> but this won't work in all cases. So to solve the problem, you can
> enclose embedded variables with back ticks (`).
>
> Example:
>
> {include file="$
smarty.section.foo.bar.tpl"}
>
> It only respects back ticks around an embedded var, so other back ticks
> in the text are not a problem. It works pretty well, thoughts?
>
> Monte
--
Monte Ohrt <monte@ispi.net>