static function tpl($group = 'home') { $tpl = tpl::get_instance(); //基本配置 $smarty = config('home', 'smarty'); // $tpl->error_reporting=$smarty['error']; // $tpl->debugging=$smarty['debug']; // $tpl->allow_php_templates=$smarty['php']; $tpl->template_dir = $smarty['template']; $tpl->compile_dir = $smarty['compile']; $tpl->config_dir = $smarty['config']; $tpl->caching = $smarty['caching']; $tpl->cache_dir = $smarty['root']; $tpl->cache_lifetime = $smarty['time']; $tpl->left_delimiter = '{'; $tpl->right_delimiter = '}'; //网站元信息 $meta = config('meta', 'site'); $tpl->assign('meta', $meta); $tpl->assign('url', dc_url); //项目域名 //设置目录常量 $dir_data = self::set_url_dir(); $tpl->assign('dir', $dir_data); //会员session if ($group == 'home') { $user_info = session::get('user'); $tpl->assign('user', $user_info); } //管理员session if ($group == 'admin') { $admin_info = session::get('admin'); $tpl->assign('admin', $admin_info); } if (defined('dc_group')) { $group_info['url'] = dc_url . dc_group . '/'; $group_info['script'] = dc_url_view . dc_group . '/script/'; $group_info['style'] = dc_url_view . dc_group . '/style/'; $group_info['image'] = dc_url_view . dc_group . '/image/'; $tpl->assign('group', $group_info); } //注册smarty组件 $class_arr = config('plugin'); tpl::parse_plugins($class_arr, $tpl); return $tpl; }