1,打开 /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");

2,再查找

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

在上面添加如下代码

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

修改完成,这样就可以在搜索模板中灵活使用帝国cms强大的灵动和万能标签了

下边的代码直接覆盖掉/e/search/result/index.php文件就可以。

<?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>&nbsp;>&nbsp;".$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);
?>

解决帝国CMS搜索页面模板不支持灵动标签和万能标签的方法的更多相关文章

  1. 帝国cms搜索关键字调用标签(showsearch)怎么用

    前面ytkah介绍了如何让帝国CMS7.2搜索模板支持动态标签调用,现在我们来说说怎么调用帝国cms搜索关键字调用标签(showsearch).在帝国cms后台那边的使用方法:[showsearch] ...

  2. IIS下实现帝国CMS搜索页伪静态

    前面ytkah讲了apache下帝国CMS搜索页伪静态实现方法,网友说服务器是用IIS,那么IIS下如何实现帝国CMS搜索页伪静态呢?首先得先有URL重写插件,下载地址:http://www.iis. ...

  3. 帝国cms实现会员注册之后根据所在会员组转向的方法

    帝国cms要实现会员注册之后根据所在会员组转向的能能,就需要修改/e/member/class/member_registerfun.php文件找到第175行,修改成如下代码: //审核 if($ch ...

  4. 帝国cms修改[!--show.listpage--]分页页码所生成的html标签

    在使用帝国cms系统时,我们用[!--show.page--]和[!--show.listpage--]来生成页码 其中[!--show.listpage--]所生成的html页码代码为: <a ...

  5. 十几万条数据的表中,基于帝国cms 。自己亲身体验三种批量更新数据的方法,每一种的速度是什么样的

    需求是 上传Excel 读取里面的数据.根据Excel中某一个字段,与数据表中的一个字段的唯一性.然后把 Excel表中数据和数据库表中数据一次更改.本次测试一次更新31条数据. 本次测试基于帝国cm ...

  6. 帝国CMS内容页模板过滤清理简介smalltext前后空格的方法!

    在内容模板你需要调用的地方使用如下代码输出简介即可过滤简介smalltext前后的空格了: <? $qian=array(" "," ","\t ...

  7. 帝国cms学习

    手册地址1 手册地址2 入门 安装: 将下载的upload里的文件上传到网站更目录 然后 域名/e/install/index.php Warning: Use of undefined consta ...

  8. 常用帝国cms标签收录

    帝国网站管理系统V6.6版-数据字典 :  http://www.phome.net/doc/manual/extend/html/dbdoc/index.html 帝国模板网:http://www. ...

  9. 设置帝国cms文章标题 真正符合百度建站标准

    百度建站指南中有提到内容页的标题设置,标题描述清晰最好包含主站和频道信息:内容标题_频道名称_网站名称.帝国cms文章标题一般默认是内容标题_网站名称,那么如何调用当前文章的频道名称(分类名称)呢? ...

随机推荐

  1. map, reduce和filter(函数式编程)

    # map可以用于对可遍历结构的每个元素执行同样的操作,批量操作: map(lambda x: x**2, [1, 2, 3, 4]) # [1, 4, 9, 16] map(lambda x, y: ...

  2. 基于pytorch实现Resnet对本地数据集的训练

    本文是使用pycharm下的pytorch框架编写一个训练本地数据集的Resnet深度学习模型,其一共有两百行代码左右,分成mian.py.network.py.dataset.py以及train.p ...

  3. 从此 Typora 代码块有了颜色

    起因 平时喜欢用typora记笔记,但是typora默认代码块没有指定语言,没有高亮看着很不舒服,所以用Autohotkey花了半天写了个脚本,按自己的快捷键就可以自动生成代码块并添加语言,这样就方便 ...

  4. Docker——时间配置

    一.常用时间表示 GMT(Greenwich Mean Time):格林威治时间,格林威治被定义为了\(0^o\)经线开始的地方,地球每15进度分为一个时区,共24个时区,相邻时区相差1个小时.中国位 ...

  5. Nginx配置不当(CRLF注入 、目录穿越)

    基于vulhub漏洞环境 环境搭建参考:https://blog.csdn.net/qq_36374896/article/details/84102101 1.漏洞名称 CRLF注入 2.漏洞原理 ...

  6. P1030

    题面 给出一棵二叉树的中序排列与后序排列.求出它的先序排列.(约定树结点用不同的大写字母表示,长度≤8). 输入格式 2行,均为大写字母组成的字符串,表示一棵二叉树的中序排列与后序排列. 输出格式 1 ...

  7. Spring---Spring专题(二)

    1.Spring配置数据源 1.1 数据源(连接池)的作用 数据源(连接池)是提高程序性能而出现的 事先实例化数据源,初始化部分链接资源 使用连接资源时从数据源中获取 使用完毕后将连接资源归还给数据源 ...

  8. jQuery--基本过滤选择器

    1.基本过滤选择器介绍 基本过滤器: :first     获取数组中第一个元素 :last      获取数组中最后一个 :eq(selector) 获取指定索引 :gt(index)     大于 ...

  9. Linux 网卡配置参数

    网卡配置文件位于 /etc/sysconfig/network-scripts/ 目录下 网卡配置文件在RHEL5/6以eth为网卡文件的前缀,在RHEL7中以ifcfg为网卡文件的前缀 配置 解释 ...

  10. Zookeeper 的 java 客户端都有哪些?

    java 客户端:zk 自带的 zkclient 及 Apache 开源的 Curator.