summaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/Service/Template.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/SemanticScuttle/Service/Template.php')
-rw-r--r--src/SemanticScuttle/Service/Template.php26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/SemanticScuttle/Service/Template.php b/src/SemanticScuttle/Service/Template.php
index 9d9a7ea..d175ce1 100644
--- a/src/SemanticScuttle/Service/Template.php
+++ b/src/SemanticScuttle/Service/Template.php
@@ -49,21 +49,35 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
$this->basedir = $GLOBALS['TEMPLATES_DIR'];
}
- function loadTemplate($template, $vars = NULL) {
- if (substr($template, -4) != '.php')
- $template .= '.php';
- $tpl =& new Template($this->basedir .'/'. $template, $vars, $this);
+ /**
+ * Loads and displays a template file.
+ *
+ * @param string $template Template filename relative
+ * to template dir
+ * @param array $vars Array of template variables.
+ *
+ * @return Template Template object
+ */
+ function loadTemplate($template, $vars = null)
+ {
+ if (substr($template, -4) != '.php') {
+ $template .= '.php';
+ }
+ $tpl = new Template($this->basedir .'/'. $template, $vars, $this);
$tpl->parse();
+
return $tpl;
}
}
-class Template {
+class Template
+{
var $vars = array();
var $file = '';
var $templateservice;
- function Template($file, $vars = NULL, &$templateservice) {
+ function Template($file, $vars = null, &$templateservice)
+ {
$this->vars = $vars;
$this->file = $file;
$this->templateservice = $templateservice;