summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-10-23 15:24:15 +0200
committerKevin Chabowski <kevin@kch42.de>2013-10-23 15:24:15 +0200
commitfce36cfcd183a6ca6d86d51b72cf41e43c349432 (patch)
tree5f0aa1826f4767eb7b8417adbf3515119bb58ffc
parent7ae08e3c35760fd7c5cb00d9a8a27488090f952d (diff)
downloadste-fce36cfcd183a6ca6d86d51b72cf41e43c349432.tar.gz
ste-fce36cfcd183a6ca6d86d51b72cf41e43c349432.tar.bz2
ste-fce36cfcd183a6ca6d86d51b72cf41e43c349432.zip
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...).
-rw-r--r--stupid_template_engine.php10
1 files 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) . '"'). ']';