<?php
/**
* Template System
*
* @version $Id$
* @copyright 2009
*/
require_once PATH.'/tpl_system/Smarty.class.php';
class page extends Smarty{
public $title;
public $module;
static protected $global = NULL;
static protected $link;
static public function Open(){
if (self::$global !== NULL) {
return self::$global;
} else {
return new self();
}
}
static function UrlSet($name, $value){
$name = urlencode($name);
$value = urlencode($value);
self::$link[$name]=$value;
}
function __construct(){
$this->compile_dir = PATH.'/files/tpl_compl/';
$this->template_dir = PATH.'/theme/'.$GLOBALS['DEFAULT_THEME'].'/';
$this->config_dir = PATH.'/theme/'.$GLOBALS['DEFAULT_THEME'].'/';
self::$global = $this;
$this->load_filter('output', 'brid');
$this->load_filter('output', 'charconv');
$this->load_filter('output', 'lang');
$this->assign('html_path', $GLOBALS['HTML_REWRITE']);
//$this->force_compile = true;
}
public function SetTheme($theme){
$this->template_dir = PATH.'/theme/'.$theme.'/';
$this->config_dir = PATH.'/theme/'.$theme.'/';
}
public function ExeTpl($name, $cache = NULL, $compile = NULL){
$this->assign('templ_link', self::$link);
if (file_exists($this->template_dir.'mod/'.$this->module.'/'.$name)) {
$this->display($this->template_dir.'mod/'.$this->module.'/'.$name, $cache, $compile);
} else {
$this->display(PATH.'/mod/'.$this->module.'/tpl/'.$name, $cache, $compile);
}
}
}
?>