diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-28 08:00:40 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-28 08:00:40 +0000 |
commit | a63765a4ad05b83f4c4ffcb7790b528f09f20a43 (patch) | |
tree | 988c575ac79515a0608bce86373620488ade8b4b /src/SemanticScuttle/Service | |
parent | 806d85f3876798feac1cc5d686ab61eaa899ba53 (diff) | |
download | semanticscuttle-a63765a4ad05b83f4c4ffcb7790b528f09f20a43.tar.gz semanticscuttle-a63765a4ad05b83f4c4ffcb7790b528f09f20a43.tar.bz2 |
cs
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@444 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle/Service')
-rw-r--r-- | src/SemanticScuttle/Service/Template.php | 26 |
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; |