Re: Base-Templates Dir Feature Added to Smarty1.4.0
| From: | Andrei Zmievski | Date: | Thu, 10 May 2001 14:23:16 +0000 |
| Subject: | Re: Base-Templates Dir Feature Added to Smarty1.4.0 | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-741@lists.php.net to get a copy of this message | ||
On Fri, 11 May 2001, Jim Harlindong wrote:
>
> function Smarty()
> {
> foreach ($this->global_assign as $var_name) {
> if(isset($GLOBALS[$var_name])) {
> $this->assign($var_name, $GLOBALS[$var_name]);
> }
> }
> }
>
> In this case $varname will contain the *value* of the array element. So
> if the element is
> Global_assign[] = 'abc';
> Global_assign['two'] = array('def', 'jkl');
>
> Now, $var_name in the foreach loop will have the *value* of the element
> which in this case are
> 'abc', array('def', 'jkl')
>
> How does the array('def', 'jkl') gets to be a non array variable
> accessed through $def and $jkl instead of $two.def and $two.jkl in
> Smarty?
You are looking at an older version of Smarty. The new one has this in
the constructor:
foreach ($this->global_assign as $key => $var_name) {
if (is_array($var_name)) {
foreach ($var_name as $var) {
if (isset($GLOBALS[$key][$var])) {
$this->assign($var, $GLOBALS[$key][$var]);
} else {
$this->assign($var, $this->undefined);
}
}
} else {
if (isset($GLOBALS[$var_name])) {
$this->assign($var_name, $GLOBALS[$var_name]);
} else {
$this->assign($var_name, $this->undefined);
}
}
}
-Andrei
* Entropy isn't what it used to be. *