如何让帝国CMS7.2搜索模板支持动态标签调用
帝国cms站内搜索一般不支持动态标签调用,如果要调用如何实现呢?修改两个地方就可以实现了。打开 /e/search/result/index.php 文件,找到(文件改了,不会调用也是徒劳!看看这个帝国cms搜索关键字调用标签(showsearch)怎么用)
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早就猜到你不想去一行行找了,哈哈,直接提供修改后的整个代码如下
<?php require("../../class/connect.php"); require("../../class/db_sql.php"); require("../../data/dbcache/class.php"); require('../../class/functions.php'); require('../../class/t_functions.php'); require "../".LoadLang("pub/fun.php"); $editor=1; eCheckCloseMods('search');//关闭模块 $link=db_connect(); $empire=new mysqlquery(); $getvar=$_GET['getvar']; if(empty($getvar)) {$getfrom="history.go(-1)"; } else {$getfrom="../../../search/"; } //搜索结果 $searchid=(int)$_GET['searchid']; if(empty($searchid)) {printerror("SearchNotRecord",$getfrom,1); } $search_r=$empire->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="<a href='".ReturnSiteIndexUrl()."'>".$fun_r['index']."</a> > ".$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("<!--list.var".$changerow."-->",$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); ?>
转载于:https://www.cnblogs.com/ytkah/p/6694823.html
如何让帝国CMS7.2搜索模板支持动态标签调用相关推荐
- 织梦新建php支持标签,织梦教程:新建php页面且模板支持读取标签
这篇文章主要为大家详细介绍了织梦教程:新建php页面且模板支持读取标签,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,有需要的朋友可以收藏方便以后借鉴. 在使用织梦dedecms建站时,想自己建立 ...
- 帝国cms7.5封面模板如何调用栏目别名作为网页title标题
对于封面页和列表页面title标题部分帝国cms建站的站长习惯使用栏目别名来调用显示页面标题,但是覃师宁博客对于栏目和封面页标题的调用习惯使用自定义字段.那么如何封面页和列表页如何调用别名作为页面标题 ...
- 帝国CMS7.5情书模板/精美情书大全站/同步生成带手机站带采集
帝国CMS7.5模板,精美情书大全站源码,同步生成带手机站带采集.非常漂亮的帝国CMS模板,适合改改做文学类的网站. 此模板适合做精美情书网站,功能比较齐全,后台操作方便,简单易上手,并拥有多款插件. ...
- ecms 列表模板php,帝国CMS列表页模板list.var分别调用年月日(显示个性时间日期)
在帝国CMS中列表页个性时间显示的实现方式,首先我们要知道用什么方法来实现,这里我们使用PHP代码来做. 要在模板代码中使用PHP代码,就必须勾选此模板代码页面的-使用程序代码.位置就在添加模板页面的 ...
- uniapp与帝国cms7.5开发实战之动态爆料订阅号app开发实战记录
公众号功能描述及操作方法 先来个界面吧. 每个订阅号有一个后台,可以用来发布信息,用户可以查看订阅号,关注订阅号,下面来看一下订阅号的管理后台. 点击增加,会自动生成一篇文章,用户可以对文章进行编辑. ...
- 帝国CMS7.5响应式后台美化模板 支持GBK+UTF
介绍: 帝国CMS7.5响应式后台美化模板 支持GBK+UTF 1.支持帝国CMS7.5版本,GBK.UTF编码 2.采用ZUI前端框架开发 3.响应式布局,兼容多终端分辨率,包含:19201080, ...
- 帝国搜索模板不支持php,解决帝国CMS搜索模板不支持灵动标签的方法
帝国CMS搜索模板调用灵动标签的时候调用不出内容的解决方法,此方法来源于帝国CMS大学.个人根据教程修改使用后能成功获得到帝国CMS文章,并分享给所以帝国CMS爱好者使用. 帝国CMS搜索模板代码修改 ...
- 帝国cms7.5内核自适应导航站模板制作教程记录
这是一篇记录关于使用帝国cms7.5内核开发制作这套网站大全.或者称为网址目录的导航站的开发记录 先看案例网址:http://ecms.qinshining.com/daohang/ 演示站,只是根据 ...
- 帝国CMS7.5仿《3500游戏》源码/大气H5游戏门户网站模板/H5游戏在线网站源码
☑️ 编号:ym219 ☑️ 品牌:帝国CMS7.5 ☑️ 语言:php ☑️ 大小:29.9MB ☑️ 类型:仿3500游戏 ☑️ 支持:门户网站模板
最新文章
- Cell子刊:建立因果关系-合成菌群在植物菌群研究中的机会
- 微信小程序设置文本左对齐居中对齐右对齐setTextAlign的使用说明
- Python图像处理库PIL从入门到精通
- CodeForces - 1343F Restore the Permutation by Sorted Segments(思维)
- C++ 析构函数设为虚函数的好处
- 表字段顺序有何影响_「品味保定」炸烹虾段乾隆赞 百年保定柔雅香
- C/C++ volatile
- paypal android sdk,Android Paypal SDK错误:商家不接受此类付款
- tcpcopy mysql_MySQL容量规划之tcpcopy应用之道 西橙
- 参与百度世界2012 赢百度APP推广大礼包
- 10年后的GOOGLE会怎么样
- 基于人工智能的盲人阅读器
- 提高元认知能力时刻掌握方向舵主动控制生命航向
- 如何查看计算机是否新装了硬盘,如何查看笔记本电脑换固态硬盘 判断笔记本电脑是否可换固态硬盘的技巧...
- 浏览器旧版本下载地址汇总——持续更新
- Exposed Acne Treatment Review
- lscpu与cat /proc/cpuinfo获取的CPU信息释义
- 快速将qsv格式转换为mp4的实用技巧
- 【千里眼智能摄像头V1.1中文免费版】方便录像照相工具
- 开一间水果店投资多少钱,开家水果店投资大不大
热门文章
- 关于_WIN32_WINNT的含义
- Python 嵌套列表解析
- 启动hiveserver2时报错Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
- failed to launch: nice -n 0 $HADOOP_HOME/bin/spark-class org.apache.spark.deploy.worker.Worker
- 基于FPGrowth挖掘算法的乳腺癌中医症型关联规则挖掘
- 【数学基础】拉格朗日对偶
- xsd文件转图片_如何将图片转化为PDF格式?分享一个超简单的方法给你
- idea 快捷键java
- mysql sql字符串连接函数_Mysql字符串连接函数 CONCAT()与 CONCAT_WS()
- 4 .2 .4 配置存储系统