aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/template.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/template.php b/include/template.php
index 42353c8c1..32beecb9a 100644
--- a/include/template.php
+++ b/include/template.php
@@ -55,6 +55,9 @@ class Template {
// This will hold the uncompiled code for that handle.
var $uncompiled_code = array();
+
+ // output
+ var $output = '';
/**
* Constructor. Simply sets the root dir.
@@ -133,6 +136,39 @@ class Template {
eval($this->compiled_code[$handle]);
return true;
}
+
+ /**
+ * fills $output template var
+ */
+ function parse($handle)
+ {
+ if (!$this->loadfile($handle))
+ {
+ die("Template->pparse(): Couldn't load template file for handle $handle");
+ }
+
+ // actually compile the template now.
+ if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle]))
+ {
+ // Actually compile the code now.
+ $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle], true, '_str');
+ }
+
+ // Run the compiled code.
+ $_str = '';
+ eval($this->compiled_code[$handle]);
+ $this->output.= $_str;
+
+ return true;
+ }
+
+ /**
+ * prints $output template var
+ */
+ function p()
+ {
+ echo $this->output;
+ }
/**
* Inserts the uncompiled code for $handle as the value of $varname in the