2 class TemplateService {
5 function &getInstance() {
7 if (!isset($instance)) {
8 $instance = new TemplateService();
13 function __construct() {
14 $this->basedir = $GLOBALS['TEMPLATES_DIR'];
17 function loadTemplate($template, $vars = NULL) {
18 if (substr($template, -4) != '.php') {
21 $tpl = new Template($this->basedir .'/'. $template, $vars, $this);
32 function __construct($file, $vars = NULL, &$templateservice) {
35 $this->templateservice = $templateservice;
39 if (isset($this->vars)) {
45 function includeTemplate($name) {
46 return $this->templateservice->loadTemplate($name, $this->vars);