From a63765a4ad05b83f4c4ffcb7790b528f09f20a43 Mon Sep 17 00:00:00 2001 From: cweiske Date: Wed, 28 Oct 2009 08:00:40 +0000 Subject: cs git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@444 b3834d28-1941-0410-a4f8-b48e95affb8f --- src/SemanticScuttle/Service/Template.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src') 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; -- cgit v1.2.3