Little tweak around GLOBAL variables
| From: | Artem Orlov | Date: | Thu, 13 Mar 2008 12:02:34 +0000 |
| Subject: | Little tweak around GLOBAL variables | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3031@lists.php.net to get a copy of this message | ||
Hello!
I think this may be usefull, now we can use special variable $smarty to
access global variables.
Like this:
{$smarty.globals.global_var}
*** Smarty_Compiler.class.php.orig Thu Feb 21 22:14:10 2002
--- Smarty_Compiler.class.php Wed Mar 13 16:32:24 2002
***************
*** 1251,1256 ****
--- 1251,1262 ----
$compiled_ref =
"\$GLOBALS['HTTP_SESSION_VARS']['$name']";
break;
+ case 'globals':
+ array_shift($indexes);
+ $name = substr($indexes[0], 1);
+ $compiled_ref = "\$GLOBALS['$name']";
+ break;
+
/*
* These cases are handled either at run-time or elsewhere
in the
* compiler.
______________________________________________
Artem Orlov http://design.ural.ru