aboutsummaryrefslogtreecommitdiff
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.php64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/SemanticScuttle/Service/Template.php b/src/SemanticScuttle/Service/Template.php
index dbe5670..110c5cf 100644
--- a/src/SemanticScuttle/Service/Template.php
+++ b/src/SemanticScuttle/Service/Template.php
@@ -1,7 +1,7 @@
<?php
class SemanticScuttle_Service_Template extends SemanticScuttle_Service
{
- protected $basedir;
+ protected $basedir;
/**
* Returns the single service instance
@@ -10,48 +10,48 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
*
* @return SemanticScuttle_Service
*/
- public static function getInstance($db)
+ public static function getInstance($db)
{
- static $instance;
- if (!isset($instance)) {
+ static $instance;
+ if (!isset($instance)) {
$instance = new self($db);
}
- return $instance;
- }
+ return $instance;
+ }
- public function __construct()
+ public function __construct()
{
- $this->basedir = $GLOBALS['TEMPLATES_DIR'];
- }
+ $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;
- }
+ 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;
+ var $vars = array();
+ var $file = '';
+ var $templateservice;
- function Template($file, $vars = NULL, &$templateservice) {
- $this->vars = $vars;
- $this->file = $file;
- $this->templateservice = $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 parse() {
+ if (isset($this->vars))
+ extract($this->vars);
+ include($this->file);
+ }
- function includeTemplate($name) {
- return $this->templateservice->loadTemplate($name, $this->vars);
- }
+ function includeTemplate($name) {
+ return $this->templateservice->loadTemplate($name, $this->vars);
+ }
}
?> \ No newline at end of file