解决帝国CMS搜索页面模板不支持灵动标签和万能标签的方法
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> > ".$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搜索页面模板不支持灵动标签和万能标签的方法的更多相关文章
- 帝国cms搜索关键字调用标签(showsearch)怎么用
前面ytkah介绍了如何让帝国CMS7.2搜索模板支持动态标签调用,现在我们来说说怎么调用帝国cms搜索关键字调用标签(showsearch).在帝国cms后台那边的使用方法:[showsearch] ...
- IIS下实现帝国CMS搜索页伪静态
前面ytkah讲了apache下帝国CMS搜索页伪静态实现方法,网友说服务器是用IIS,那么IIS下如何实现帝国CMS搜索页伪静态呢?首先得先有URL重写插件,下载地址:http://www.iis. ...
- 帝国cms实现会员注册之后根据所在会员组转向的方法
帝国cms要实现会员注册之后根据所在会员组转向的能能,就需要修改/e/member/class/member_registerfun.php文件找到第175行,修改成如下代码: //审核 if($ch ...
- 帝国cms修改[!--show.listpage--]分页页码所生成的html标签
在使用帝国cms系统时,我们用[!--show.page--]和[!--show.listpage--]来生成页码 其中[!--show.listpage--]所生成的html页码代码为: <a ...
- 十几万条数据的表中,基于帝国cms 。自己亲身体验三种批量更新数据的方法,每一种的速度是什么样的
需求是 上传Excel 读取里面的数据.根据Excel中某一个字段,与数据表中的一个字段的唯一性.然后把 Excel表中数据和数据库表中数据一次更改.本次测试一次更新31条数据. 本次测试基于帝国cm ...
- 帝国CMS内容页模板过滤清理简介smalltext前后空格的方法!
在内容模板你需要调用的地方使用如下代码输出简介即可过滤简介smalltext前后的空格了: <? $qian=array(" "," ","\t ...
- 帝国cms学习
手册地址1 手册地址2 入门 安装: 将下载的upload里的文件上传到网站更目录 然后 域名/e/install/index.php Warning: Use of undefined consta ...
- 常用帝国cms标签收录
帝国网站管理系统V6.6版-数据字典 : http://www.phome.net/doc/manual/extend/html/dbdoc/index.html 帝国模板网:http://www. ...
- 设置帝国cms文章标题 真正符合百度建站标准
百度建站指南中有提到内容页的标题设置,标题描述清晰最好包含主站和频道信息:内容标题_频道名称_网站名称.帝国cms文章标题一般默认是内容标题_网站名称,那么如何调用当前文章的频道名称(分类名称)呢? ...
随机推荐
- 解决移动端ios网页端收起键盘导致的页面空白问题
一句代码就搞定了,只要失焦的时候把窗口滚动位置设置到(0,0)就行了 <input type="text" onblur="window.scrollTo(0, 0 ...
- Linux下使用Google Authenticator配置SSH登录动态验证码
1.一般ssh登录服务器,只需要输入账号和密码.2.本教程的目的:在账号和密码之间再增加一个验证码,只有输入正确的验证码之后,再输入密码才能登录.这样就增强了ssh登录的安全性.3.账号.验证码.密码 ...
- springcloud学习03-spring cloud eureka(下)
7.配置服务提供者(生产者) 7.1.配置resources/application.yml. 值eureka.client.service-url(或serviceUrl).defaultZone是 ...
- IDEA的git的拉去提交Java day9
赶鸭子上架,没法子. 新的知识点24号继续学习,今天认真熟悉了以下IDEA,的git代码的提交和拉去,不过拉去下来的项目有些打开的问题有点多,还在继续解决中-- git知识明天一并上传博客.
- .NET中XML序列化和反序列化常用类和用来控制XML序列化的属性总结(XmlSerializer,XmlTypeAttribute,XmlElementAttribute,XmlAttributeAttribute,XmlArrayAttribute...)
序列化和反序列化是指什么? 序列化(seriallization): 将对象转化为便于传输的数据格式, 常见的序列化格式:二进制格式,字节数组,json字符串,xml字符串.反序列化(deserial ...
- 无传感FOC控制中的转子位置和速度确定方法一
使用PLL估算器在无感的情况下,估计转子的角度和角速度 PLL估算器的工作原理基于反电动势的d分量在稳态下等于零,其框图如下: ΚΦ 表示电压常量,下面给出了电气转速计算中使用的归 一化 ΚΦ : ...
- CF1556F Sports Betting (状压枚举子集DP)
F 对于一张比赛图,经过缩点,会得到dag,且它一定是transitive的,因此我们能直接把比赛图缩成一个有向链.链头作为一个强连通分量,里面的所有点都是胜利的 定义F(win)表示win集合作为赢 ...
- Java 中计算注意!!!
* 使用BigDecimal需要注意的事项: * 1.两个BigDecimal值不能使用" +, -, *, / " 进行加减乘除,要使用" add, substrac ...
- Java代码规范总结,更新持续中
1. 实例的开启与关闭 var zkClient: ZooKeeper = null try { zkClient = new ZooKeeper(getZkUrl(), 2000, new Watc ...
- java反射 java动态代理和cglib动态代理的区别
java反射 https://blog.csdn.net/f2764052703/article/details/89311013 java 动态代理 https://blog.csdn ...