// +---------------------------------------------------------------------- // $Id: TemplateSmart.class.php 2730 2012-02-12 04:45:34Z liu21st $ /** +------------------------------------ * Smart模板引擎驱动类 +------------------------------------ */ class TemplateSmart { /** +---------------------------------------------------------- * 渲染模板输出 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @param string $templateFile 模板文件名 * @param array $var 模板变量 +---------------------------------------------------------- * @return void +---------------------------------------------------------- */ public function fetch($templateFile,$var) { $templateFile=substr($templateFile,strlen(TMPL_PATH)); vendor('SmartTemplate.class#smarttemplate'); $tpl = new SmartTemplate($templateFile); if(C('TMPL_ENGINE_CONFIG')) { $config = C('TMPL_ENGINE_CONFIG'); foreach ($config as $key=>$val){ $tpl->{$key} = $val; } }else{ $tpl->caching = C('TMPL_CACHE_ON'); $tpl->template_dir = TMPL_PATH; $tpl->temp_dir = CACHE_PATH ; $tpl->cache_dir = TEMP_PATH ; } $tpl->assign($var); $tpl->output(); } }