/** * 载入模板 * * @param string $template 模板名 * @param string $tpl_dir 模板文件目录 * @return string 模板缓存文件路径 */ function hg_load_template($template, $tpl_dir = './tpl/') { $template_file = $template . '.tpl.php'; $tpl_dir = TEMPLATES_DIR; if (DEVELOP_MODE) { return $tpl_dir . $template_file; } $cache_template_file = md5($template_file . realpath($tpl_dir)) . '.php'; $template_cache_file = CACHE_DIR . 'tpl/' . $cache_template_file; if (!is_file($template_cache_file)) { include_once './lib/template.class.php'; $template = new Template(); $template->ParseTemplate($template_file); } return $template_cache_file; }