From fce36cfcd183a6ca6d86d51b72cf41e43c349432 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Wed, 23 Oct 2013 15:24:15 +0200 Subject: Adding default values to some properties. To reduce the ridiculous amount of notices PHP throws when parsing and executing templates (should really be fixed in the future, this is quite embarassing...). --- stupid_template_engine.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stupid_template_engine.php b/stupid_template_engine.php index 78a3eec..58b327d 100644 --- a/stupid_template_engine.php +++ b/stupid_template_engine.php @@ -38,14 +38,18 @@ class TextNode extends ASTNode class TagNode extends ASTNode { public $name; - public $params; - public $sub; + public $params = array(); + public $sub = array(); + public function __construct($tpl, $off, $name = "") { + parent::__construct($tpl, $off); + $this->name = $name; + } } class VariableNode extends ASTNode { public $name; - public $arrayfields; + public $arrayfields = array(); public function transcompile() { $varaccess = '@$ste->vars[' . (is_numeric($this->name) ? $this->name : '"' . escape_text($this->name) . '"'). ']'; -- cgit v1.2.3-54-g00ecf