From 012268591bbf9b294ee97bf7f824e22a50c803de Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 26 Jun 2008 10:37:44 -0400 Subject: [PATCH] Add BSTemplate::$globalVars that every template will substitute through * Template.php: (BSTemplate::evaluate) --- CHANGES | 1 + Template.php | 7 +++++++ 2 files changed, 8 insertions(+) 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 -- 2.22.5