帝国CMS控制面板/会员中心模板支持变量标签调用的方法
更新时间:2015年12月30日 16:42 点击:1790
现在很多帝国CMS网站的会员中心头尾与网站首页的头尾是一样的,这就要求帝国CMS的会员中心也就是控制面版能支持标签调用,支持模板变量调用,如:[!---temp.header--]
但是帝国CMS本身是不支持的。
通过以下教程可以实现控制面版也就是会中心也支持调用模板变量标签。
第一步:
打开/e/class/functions.php 找到
============================= //解析代码 function RepExeCode($string) =============================
在这上面添加以下代码:
//标签替换4 function CustomNewsBq($name,$indextext){ global $empire,$dbtbpre,$public_r,$emod_r,$class_r,$class_zr,$fun_r,$navclassid,$navinfor,$class_tr,$level_r,$etable_r; $file=ECMS_PATH.'e/data/tmp/dt_temp'.$name.'.php'; $indextext=stripSlashes($indextext); $indextext=ReplaceTempvar($indextext);//替换全局模板变量 //替换标签 $indextext=DoRepEcmsLoopBq($indextext); $indextext=RepBq($indextext); //写文件 WriteFiletext($file,AddCheckViewTempCode().$indextext); //读取文件内容 ob_start(); include($file); $string=ob_get_contents(); ob_end_clean(); $string=RepExeCode($string);//解析代码 return $string; }
第二步:
查找:
WriteFiletext($file1,AddCheckViewTempCode().$r[0]);
修改为:
$tmplist= CustomNewsBq ("cp0",$r[0]); WriteFiletext($file1,$tmplist);
第三步:
找到:
WriteFiletext($file2,AddCheckViewTempCode().$r[1]);
修改为:
$tmplist= CustomNewsBq ("cp1",$r[1]); WriteFiletext($file2,$tmplist);
如此,帝国cms就可以实现控制面板模板头尾支持标签调用了。
相关文章
- 现在很多帝国CMS网站的会员中心头尾与网站首页的头尾是一样的,这就要求帝国CMS的会员中心也就是控制面版能支持标签调用,支持模板变量调用,如:[!---temp.header--]但是帝国...2015-12-30