在UCHome的二次开发中,若不屏蔽tpl_cache,每次更新页面都需要去删除uchome\data\tpl_cache目录中的文件,或者在管理业页面中更新缓存,很麻烦。 要禁用tpl_cache,只需在source\function_common.php中找到 function template($name)函数,将其中的一个if判断注释掉就可以了,如下面的代码中的红色字体:

//模板调用 function template($name) { global $_SCONFIG, $_SGLOBAL; if($_SGLOBAL['mobile']) { $objfile = S_ROOT.'./api/mobile/tpl_'.$name.'.php'; if (!file_exists($objfile)) { showmessage('m_function_is_disable_on_wap'); } } else { if(strexists($name,'/')) { $tpl = $name; } else { $tpl = "template/$_SCONFIG[template]/$name"; } $objfile = S_ROOT.'./data/tpl_cache/'.str_replace('/','_',$tpl).'.php'; //if(!file_exists($objfile)) {  //注释掉是为了调试方便,正式使用环境中请取消注释! include_once(S_ROOT.'./source/function_template.php'); parse_template($tpl); //} } return $objfile; }

Recent Posts