Add BSTemplate::$globalVars that every template will substitute through
authorRobert Sesek <rsesek@bluestatic.org>
Thu, 26 Jun 2008 14:37:44 +0000 (10:37 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Thu, 26 Jun 2008 14:37:44 +0000 (10:37 -0400)
* Template.php:
(BSTemplate::evaluate)

CHANGES
Template.php

diff --git a/CHANGES b/CHANGES
index 244c43eb703bac71c1900ae878d5a3ecabe3d8fc..cbc06aab47e531416e4f98eb77b022108dd5b9dc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -10,3 +10,4 @@
 - Change: BSTemplate is completely redone
 - New: Implement Iterator in BSDBResult
 - New: In the BSTemplate::$preParseHook method, the second parameter will be the BSTemplate object itself
+- New: Add BSTemplate::$globalVars to be substituted into every template
index 82d533ed8a13fdb429493bfab6f1ec4cf516b46a..2a03747cec333fdf13ff1416f5c72a3b5cebef4d 100644 (file)
@@ -87,6 +87,12 @@ class BSTemplate
         */
        public $vars = array();
        
+       /**
+        * Global variables
+        * @var array
+        */
+       public static $globalVars = array();
+       
        /**
         * The file name of the template
         * @var string
@@ -186,6 +192,7 @@ class BSTemplate
        public function evaluate()
        {
                extract($this->vars);
+               extract(self::$globalVars);
                
                ob_start();
                $this->template = str_replace(array('$this->', 'self::'), 'null', $this->template); // don't want internal access coming from a template