<?
require COMMON_DIR . '/Smarty/Smarty.class.php';

class MySmarty extends Smarty {

   function MySmarty(){
	    //$smarty->force_compile = true;
	    //$smarty->debugging    = true;
	    //$smarty->caching      = true;
		$this->template_dir = ROOT_DIR.GetSkin();
		$this->compile_dir  = ROOT_DIR.GetCompileDir();
		$this->cache_dir    = ROOT_DIR.GetCacheDir();
		$this->config_dir   = COMMON_DIR."/Smarty/config";
		$this->left_delimiter = "{{";
		$this->right_delimiter = "}}";
		//die( "*** $this->template_dir ***");
   }

   function display($resource_name, $cache_id = null, $compile_id = null)
   {
        $this->fetch($resource_name, $cache_id, $compile_id, true);
   }

   function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
   {
		$html = parent::fetch($resource_name, $cache_id , $compile_id , false);
		$html = str_replace("resources/",$GLOBALS['parentpath']."/".GetSkin()."/resources/",$html);
        if($display) echo $html;
		else return $html;
   }

   function baseDisplay($resource_name, $cache_id = null, $compile_id = null)
   {
        $this->baseFetch($resource_name, $cache_id, $compile_id, true);
   }

   function baseFetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
   {
        return parent::fetch($resource_name, $cache_id , $compile_id , $display);
   }
}
?>