在框架功能文件global.func.php中修改 template功能如下
function template($module = '', $template = 'index', $theme = ''){
if(!$module) $module = 'index';
$template_c = YZMPHP_PATH.'cache'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR;
$theme = !$theme ? (!defined('MODULE_THEME') ? C('site_theme') : MODULE_THEME) : $theme;
$template_path = APP_PATH.$module.DIRECTORY_SEPARATOR.'view'.DIRECTORY_SEPARATOR.$theme.DIRECTORY_SEPARATOR;
$template_default_path = APP_PATH.$module.DIRECTORY_SEPARATOR.'view'.DIRECTORY_SEPARATOR.'default'.DIRECTORY_SEPARATOR;
$filename = $template.'.html';
$tplfile = $template_path.$filename;
if(!is_file($tplfile)) {
$tplfile=$template_default_path.$filename;
$template_path = $template_default_path;
if(!is_file($tplfile)) {
$template = APP_DEBUG ? str_replace(YZMPHP_PATH, '', $tplfile) : name($tplfile);
showmsg($template.L('template_does_not_exist'), 'stop');
}
}
if(!is_dir(YZMPHP_PATH.'cache'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR)){
@mkdir(YZMPHP_PATH.'cache'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR, 0777, true);
}
$template = name($template).'_'.md5($template_path.$template);
$template_c = $template_c.$template.'.tpl.php';
if(!is_file($template_c) || filemtime($template_c) < filemtime($tplfile)) {
$yzm_tpl = yzm_ ::load_sys_class('yzm_tpl');
$compile = $yzm_tpl->tpl_replace(@file_get_contents($tplfile));
file_put_contents($template_c, $compile);
}
return $template_c;
}
4年前