emlog做模板预览修改(貌似有点问题)
emlog做模板预览修改,我是修改了两个文件,index.php和init.php。这样做能达到效果,但是有些模板第一进去会报错,需要刷新一次才正常显示。
首先是index.php找到
define('TEMPLATE_PATH', TPLS_PATH.Option::get('nonce_templet').'/');//前台模板路径替换成:
if(isset($_GET['showtpl']) && file_exists(TPLS_PATH.$_GET['showtpl'])){
define('TEMPLATE_PATH', TPLS_PATH.(isset($_GET['showtpl']) ? $_GET['showtpl'] : Option::get('nonce_templet')).'/');//前台模板路径
}else{
define('TEMPLATE_PATH', TPLS_PATH.Option::get('nonce_templet').'/');//前台模板路径
}init.php找到
//前台模板URL
define('TEMPLATE_URL', TPLS_URL.Option::get('nonce_templet').'/');在前面添加:
if(isset($_GET['showtpl']) && file_exists(TPLS_PATH.$_GET['showtpl'])){
$options = $CACHE->readCache('options');
$options['nonce_templet'] = $_GET['showtpl'];
$cacheData = serialize($options);
$CACHE->cacheWrite($cacheData, 'options');
}本行替换成:
if(isset($_GET['showtpl']) && file_exists(TPLS_PATH.$_GET['showtpl'])){
//前台模板URL
define('TEMPLATE_URL',TPLS_URL.(isset($_GET['showtpl']) ? $_GET['showtpl'] : Option::get('nonce_templet')).'/');
}else{
define('TEMPLATE_URL', TPLS_URL.Option::get('nonce_templet').'/');
}
Tag: emlog预览
1 Comments So Far !