public function display() { header('Content-Type:text/html;charset=utf-8'); $filePath = hopedir . '/lib/Smarty/libs/Smarty.class.php'; if (!class_exists('smarty')) { include_once $filePath; } $smarty = new Smarty(); $smarty->cache_lifetime = 0; $smarty->caching = false; $smarty->template_dir = './templates'; $smarty->compile_dir = './templates_c'; $smarty->cache_dir = './smarty_cache'; $smarty->left_delimiter = '<{'; $smarty->right_delimiter = '}>'; $smarty->assign('controlname', $this->ctrlId); $smarty->assign('urlshort', $this->ctrlId . '/' . $this->tplname); $templtepach = $this->module->config['sitetemp'] . '/' . $this->ctrlId . '/' . $this->tplname . '.html'; if (!file_exists('templates/' . $templtepach)) { $this->error('模板文件不存在'); } $smarty->registerPlugin('function', 'ofunc', 'FUNC_function'); $smarty->registerPlugin('block', 'oblock', 'FUNC_block'); $data = $this->getdata(); foreach ($data as $key => $value) { $smarty->assign($key, $value); } if ($this->ctrlId == 'admin') { $menu = adminmenu::submenu($data['admininfo']['limit']); $smarty->assign('menu', $menu); } $smarty->display($templtepach); }