Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing a variable (local or global) of PHP file from smarty

I have a php file that has some local and global variables (e.g. $foo)
an smarty object is called from this file.
How can I access $foo from smarty script without changing PHP file?

Thanks

like image 653
Ariyan Avatar asked Jan 27 '12 15:01

Ariyan


1 Answers

If you have a constant variable called BASE, and defined like this:

define('BASE', 'Boise');

you can access the variable in smarty the following way:

$smarty.const.BASE
like image 175
Darin Peterson Avatar answered Oct 03 '22 21:10

Darin Peterson