博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何让帝国CMS7.2搜索模板支持动态标签调用
阅读量:7210 次
发布时间:2019-06-29

本文共 3787 字,大约阅读时间需要 12 分钟。

  帝国cms站内搜索一般不支持动态标签调用,如果要调用如何实现呢?修改两个地方就可以实现了。打开 /e/search/result/index.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");

  修改为如下

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");

接着查找:

//替换公共模板变量$listtemp=$tempr[temptext];

在上面添加以下代码:

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

  ytkah早就猜到你不想去一行行找了,哈哈,直接提供修改后的整个代码如下

fetch1("select searchid,keyboard,result_num,orderby,myorder,tbname,tempid,andsql,trueclassid from {
$dbtbpre}enewssearch where searchid='$searchid'");if(empty($search_r['searchid'])||InfoIsInTable($search_r[tbname])){ printerror("SearchNotRecord",$getfrom,1);}$page=(int)$_GET['page'];$page=RepPIntvar($page);$start=0;$page_line=$public_r['search_pagenum'];//每页显示链接数$line=$public_r['search_num'];//每页显示记录数$offset=$page*$line;//总偏移量$search="&searchid=".$searchid;$myorder=$search_r[orderby];if(empty($search_r[myorder])){ $myorder.=" desc";}$add=stripSlashes($search_r['andsql']);$num=$search_r[result_num];$query="select * from {
$dbtbpre}ecms_".$search_r[tbname].($add?' where '.substr($add,5):'');$query.=" order by ".$myorder." limit $offset,$line";$sql=$empire->query($query);$listpage=page1($num,$line,$page_line,$start,$page,$search);//取得模板if($search_r['tempid']){ $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$search_r['tempid']."' limit 1");}elseif(empty($class_r[$search_r[trueclassid]][searchtempid])){ $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1");}else{ $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$class_r[$search_r[trueclassid]][searchtempid]."' limit 1");}$have_class=1;//页面支持标签$tempr[temptext]=DtNewsBq('list'.$tempid,$tempr[temptext],0);//替换公共模板变量$listtemp=$tempr[temptext];if($public_r['searchtempvar']){ $listtemp=ReplaceTempvar($listtemp);}$search_r[keyboard]=ehtmlspecialchars($search_r[keyboard]);$listtemp=str_replace("[!--show.page--]",$listpage,$listtemp);$listtemp=str_replace("[!--keyboard--]",$search_r[keyboard],$listtemp);$listtemp=str_replace("[!--ecms.num--]",$num,$listtemp);$url="".$fun_r['index']." > ".$fun_r['adsearch'];$pagetitle=$fun_r['adsearch']." ".$search_r[keyboard];$listtemp=ReplaceSvars($listtemp,$url,0,$pagetitle,$pagetitle,$pagetitle,$add,0);$rownum=$tempr[rownum];if(empty($rownum)){ $rownum=1;}$formatdate=$tempr[showdate];$subnews=$tempr[subnews];$subtitle=$tempr[subtitle];$docode=$tempr[docode];$modid=$tempr[modid];$listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tempr[listvar]);//字段$ret_r=ReturnReplaceListF($tempr[modid]);//取得列表模板$list_exp="[!--empirenews.listtemp--]";$list_r=explode($list_exp,$listtemp);$listtext=$list_r[1];$no=$offset+1;$changerow=1;while($r=$empire->fetch($sql)){ //替换列表变量 $repvar=ReplaceListVars($no,$listvar,$subnews,$subtitle,$formatdate,$url,$have_class,$r,$ret_r,$docode); $listtext=str_replace("
",$repvar,$listtext); $changerow+=1; //超过行数 if($changerow>$rownum) { $changerow=1; $string.=$listtext; $listtext=$list_r[1]; } $no++;}db_close();$empire=null;//多余数据if($changerow<=$rownum&&$listtext<>$list_r[1]){ $string.=$listtext;}$string=$list_r[0].$string.$list_r[2];echo stripSlashes($string);?>

 

转载地址:http://bmgum.baihongyu.com/

你可能感兴趣的文章
怎么解决在微信中不能直接下载APP(APK)的方案
查看>>
你真的懂switch吗?聊聊switch语句中的块级作用域
查看>>
JS基础(对象创建,构造函数、原型、实例之间关系,继承方式)
查看>>
在Kubernetes集群上部署和管理JFrog Artifactory
查看>>
Prettier+VScode 治好你的代码洁癖
查看>>
macOS安装配置MySQL
查看>>
环形百分比控件iantoo.percent()
查看>>
专访阿里数据库备份专家 教你pick最有效的备份系统
查看>>
【刷算法】判断链表是否有环以及返回入环节点
查看>>
XXL-CONF v1.5.0 发布,分布式配置中心
查看>>
Java 操作符(3)
查看>>
教你springboot maven多模块如何部署
查看>>
Java并发编程实战笔记(3)-对象的组合
查看>>
记一次ORFfinder本地化所遇到的问题
查看>>
Laravel 大将之 服务容器 模块
查看>>
leetcode 479. Largest Palindrome Product
查看>>
Zsh 开发指南(第十六篇 alias 和 eval 的用法)
查看>>
[LeetCode] Repeated Substring Pattern
查看>>
工厂方法模式
查看>>
CSS基础篇--CSS3 Filter详解(改变模糊度 亮度 透明度等方法)
查看>>