aboutsummaryrefslogtreecommitdiff
path: root/services/templateservice.php
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-21 11:22:40 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-21 11:22:40 +0000
commit9d22fdc36f6257de021f36b26ce33eba99d41dc0 (patch)
tree3688465b99226d20751130a1cb5acb84f53009d1 /services/templateservice.php
parent5db18a09c4eca4560c117f0b4dcd85d75e7139f2 (diff)
downloadsemanticscuttle-9d22fdc36f6257de021f36b26ce33eba99d41dc0.tar.gz
semanticscuttle-9d22fdc36f6257de021f36b26ce33eba99d41dc0.tar.bz2
Minor refactoring
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@170 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'services/templateservice.php')
-rw-r--r--services/templateservice.php78
1 files changed, 39 insertions, 39 deletions
diff --git a/services/templateservice.php b/services/templateservice.php
index 191ab8d..05e494c 100644
--- a/services/templateservice.php
+++ b/services/templateservice.php
@@ -1,46 +1,46 @@
<?php
class TemplateService {
- var $basedir;
-
- function &getInstance() {
- static $instance;
- if (!isset($instance))
- $instance =& new TemplateService();
- return $instance;
- }
-
- function TemplateService() {
- $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);
- $tpl->parse();
- return $tpl;
- }
+ var $basedir;
+
+ function &getInstance() {
+ static $instance;
+ if (!isset($instance))
+ $instance =& new TemplateService();
+ return $instance;
+ }
+
+ function TemplateService() {
+ $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);
+ $tpl->parse();
+ return $tpl;
+ }
}
class Template {
- var $vars = array();
- var $file = '';
- var $templateservice;
-
- function Template($file, $vars = NULL, &$templateservice) {
- $this->vars = $vars;
- $this->file = $file;
- $this->templateservice = $templateservice;
- }
-
- function parse() {
- if (isset($this->vars))
- extract($this->vars);
- include($this->file);
- }
-
- function includeTemplate($name) {
- return $this->templateservice->loadTemplate($name, $this->vars);
- }
+ var $vars = array();
+ var $file = '';
+ var $templateservice;
+
+ function Template($file, $vars = NULL, &$templateservice) {
+ $this->vars = $vars;
+ $this->file = $file;
+ $this->templateservice = $templateservice;
+ }
+
+ function parse() {
+ if (isset($this->vars))
+ extract($this->vars);
+ include($this->file);
+ }
+
+ function includeTemplate($name) {
+ return $this->templateservice->loadTemplate($name, $this->vars);
+ }
}
?> \ No newline at end of file