public final function parseView($f_objView) { $tpl = new SmartyTpl($this, $this, 'views'); $tpl->display(PROJECT_VIEWS . '/' . $f_objView->id . '.php'); }
/** * 检查smarty缓存,有缓存直接输出缓存 * @author 肖飞 <*****@*****.**> * @param array $arrMOutput smarty数组 * @param string $cache_id 缓存文件的ID * @return object */ public function iscached($arrMOutput = array(), $cache_id = NULL) { $objSmarty = new SmartyTpl(); if (empty($arrMOutput['template_dir'])) { $objSmarty->setTemplateDir($this->arrGSmarty['template_dir']); } else { $objSmarty->setTemplateDir($arrMOutput['template_dir']); } $objSmarty->setCompileDir($this->arrGSmarty['compile_dir']); $objSmarty->setCacheDir($this->arrGSmarty['cache_dir']); $objSmarty->plugins_dir = $this->arrGSmarty['plugins_dir']; $objSmarty->config_dir = $this->arrGSmarty['config_dir']; $arrMOutput['smarty_debug'] ? $objSmarty->compile_check = true : ''; $arrMOutput['smarty_debug'] ? $objSmarty->debugging = true : ''; $objSmarty->caching = $this->arrGSmarty['caching']; if ($arrMOutput['template_file'] == 'admin.html') { $objSmarty->caching = false; } if ($objSmarty->caching) { //$cache_id = md5($_SERVER["SCRIPT_URL"]); if (empty($cache_id)) { $objSmarty->cache_id = $_SESSION['langset'] . $_GET['sub'] . $_SERVER['REQUEST_URI']; } $objSmarty->cache_lifetime = isset($this->arrGSmarty['cache_lifetime']) ? $this->arrGSmarty['cache_lifetime'] : 3600; $objSmarty->cache_modified_check = isset($this->arrGSmarty['cache_modified_check']) ? $this->arrGSmarty['cache_modified_check'] : false; if ($objSmarty->is_cached($arrMOutput['template_file'], $objSmarty->cache_id)) { $this->objSmarty = $objSmarty; $objSmarty->display($arrMOutput['template_file'], $objSmarty->cache_id); exit; } } return $objSmarty; }
/** * smarty输出函数 * @author 肖飞 <*****@*****.**> * @param array $arrMOutput smarty数组 * @return void */ function output($arrMOutput = array(), $cache_id = NULL) { $objSmarty = new SmartyTpl(); if (!isset($arrMOutput['template_dir'])) { $arrMOutput['template_dir'] = ''; } $objSmarty->setTemplateDir($this->arrGSmarty['template_dir'] . $arrMOutput['template_dir']); $objSmarty->setCompileDir($this->arrGSmarty['compile_dir']); $objSmarty->setCacheDir($this->arrGSmarty['cache_dir']); $objSmarty->plugins_dir = $this->arrGSmarty['plugins_dir']; $arrMOutput['smarty_debug'] = ''; $arrMOutput['smarty_debug'] ? $objSmarty->compile_check = true : ''; $arrMOutput['smarty_debug'] ? $objSmarty->debugging = true : ''; $objSmarty->caching = $this->arrGSmarty['caching']; if ($objSmarty->caching) { //$cache_id = md5($_SERVER["SCRIPT_URL"]); if ($cache_id == NULL) { $cache_id = $_SESSION['langset'] . $_SERVER['REQUEST_URI']; } $objSmarty->cache_lifetime = isset($this->arrGSmarty['cache_lifetime']) ? $this->arrGSmarty['cache_lifetime'] : 3600; $objSmarty->cache_modified_check = isset($this->arrGSmarty['cache_modified_check']) ? $this->arrGSmarty['cache_modified_check'] : false; } if (!empty($arrMOutput['smarty_assign'])) { while (list($key, $value) = each($arrMOutput['smarty_assign'])) { $objSmarty->assign($key, $value); } } if ($_SESSION['langset'] == 'zh_tw') { $objSmarty->autoload_filters = array('output' => array('langset')); } if (!empty($_GET['type']) && $_GET['type'] == 'doc') { $arrMOutput['template_file'] = "framedoc.html"; } $objSmarty->display($arrMOutput['template_file'], $cache_id); }