大家都知道搜索頁面不支持標簽,但是對于需要完善搜索功能的站長需要特殊功能。如何讓帝國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在這個標簽的后面增加一個標簽
實例代碼如下:
//標簽替換 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查找 //替換公共模板變量 此處修改為:
//頁面支持標簽 |
這樣即可消除此BUG,雖然不完善,但是足夠使用了。
新聞熱點
疑難解答