帝国cms搜索页面不支持灵动标签等调用的解决办法

帝国cms的搜索页面默认是不支持灵动标签、万能标签这类标签调用的,可以直接写php查询,但这对新手来说是有门槛的,接下来cms大学和大家分享一下通过修改文件来让搜索页面、反馈页面、留言页面支持标签调用。

修改 e/search/result/index.php

原来的部分

<?php  
require("../../class/connect.php");  
require("../../class/db_sql.php");  
require("../../data/dbcache/class.php");  
require("../../class/q_functions.php");  
require "../".LoadLang("pub/fun.php"); 

 修改为

<?php  
require("../../class/connect.php");  
require("../../class/db_sql.php");  
require("../../class/functions.php");  
require("../../class/t_functions.php");  
require("../../data/dbcache/class.php");  
require "../".LoadLang("pub/fun.php");  

 查找  //替换公共模板变量 ,在它的上面增加:

 

//页面支持标签  
$tempr[temptext]=DtNewsBq('list'.$tempid,$tempr[temptext],0); 

 

 

到这里搜索页面就可以支持标签调用数据了,但这样有bug,经过我们使用测试,发现在多个搜索页面模板间切换时,模板并没有变化。

经判断是缓存造成的,我们需要找到/e/class/functions.php文件,搜索 //标签替换4 ,在它的标签的后面增加一个标签,代码如下:

 

//标签替换5  
function DtNewsBq2($classid,$indextext,$ecms=0){  
global $empire,$dbtbpre,$public_r,$emod_r,$class_r,$class_zr,$fun_r,$navclassid,$navinfor,$class_tr,$level_r,$etable_r;  
$cachetime=0;  
$file=ECMS_PATH.'e/data/tmp/list'.$classid.'.php';  
if($cachetime&&file_exists($file)){  
$filetime=filemtime($file);  
$string=RepExeCode($string);//解析代码  
return $string;  
}  
$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;  
}  

 

 打开/e/search/result/index.php文件,查找  //页面支持标签  此处修改为:

//页面支持标签  
$tempr[temptext]=DtNewsBq2('list'.$tempid,$tempr[temptext],0);  

 到这里,搜索页等动态页面不支持标签调用的问题就解决了。

 

posted @ 2026-05-04 12:10  IT驿站  阅读(14)  评论(0)    收藏  举报