From: Robert Sesek Date: Thu, 26 Jun 2008 14:37:44 +0000 (-0400) Subject: Add BSTemplate::$globalVars that every template will substitute through X-Git-Tag: 3.1.0~5 X-Git-Url: https://src.bluestatic.org/?a=commitdiff_plain;h=012268591bbf9b294ee97bf7f824e22a50c803de;p=isso.git Add BSTemplate::$globalVars that every template will substitute through * Template.php: (BSTemplate::evaluate) --- diff --git a/CHANGES b/CHANGES index 244c43e..cbc06aa 100644 --- 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 diff --git a/Template.php b/Template.php index 82d533e..2a03747 100644 --- a/Template.php +++ b/Template.php @@ -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