让帝国cms搜索页模板支持php代码
更新时间:2013年12月1日 01:58 点击:558
1.在/e/search/result/index.php头上加入
require('../../class/functions.php');
2.在/e/search/result/index.php 120行左右
//替换公共模板变量 $listtemp=$tempr[temptext];
这行代码之前加上
$tempr[temptext]=DtNewsBq('list'.$tempr[tempid],$tempr[temptext],0);
完整代码如下:
<?php require("../../class/connect.php"); include("../../class/db_sql.php"); include("../../data/dbcache/class.php"); require('../../class/functions.php'); require('../../class/t_functions.php'); include "../".LoadLang("pub/fun.php"); $editor=1; $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'])) { printerror("SearchNotRecord",$getfrom,1); } $page=(int)$_GET['page']; $start=0; $page_line=$public_r['search_pagenum'];//每页显示链接数 $line=$public_r['search_num'];//每页显示记录数 if(!(int)$_GET['line']){ $line=$public_r['search_num'];//每页显示记录数 }else{ $line=(int)$_GET['line']; $search="&line=".(int)$_GET['line']; } $search.="&classid=".(int)$_GET['classid']; $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]." where checked=1".$add; $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 tempid,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 tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1"); } else { $tempr=$empire->fetch1("select tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$class_r[$search_r[trueclassid]][searchtempid]."' limit 1"); } $have_class=1; //页面支持标签(zhuxianfei.com) $tempr[temptext]=DtNewsBq('list'.$tempr[tempid],$tempr[temptext],0); //替换公共模板变量 $listtemp=$tempr[temptext]; if($public_r['searchtempvar']) { $listtemp=ReplaceTempvar($listtemp); } $search_r[keyboard]=htmlspecialchars($search_r[keyboard]); $listtemp=str_replace("[!--show.page--]",$listpage,$listtemp); $listtemp=str_replace("",$search_r[keyboard],$listtemp); $listtemp=str_replace("[!--ecms.num--]",$num,$listtemp); $url="<a href='".$public_r[newsurl]."'>".$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('/',$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); ?>
相关文章
- 是否提取 getfirsttitlepic 1 缩略图宽度 getfirsttitlespicw 105 缩略图高度 getfirsttitlespich 118...2014-10-17
- /*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) 帝国CMS显示指定时间内更新的信息数...2016-11-01
- 用灵动标签(e:loop)可以实现各种幻灯效果,本节讲解制作幻灯的基本方法。 如本站JS焦点图频道里的大部分幻灯图片效果都可以用灵动标签调用的。 ...2015-12-30
帝国CMS把[!--list.pageno--]就替换成“第[!--list.pageno--]页
/*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) 打开:e\class\functions.php 修改 $s...2017-07-06- 刚升级一会就出现 Multiple primary key definedalter table ***_ecms_infoclass_shop change classid classid int(10) unsigned NOT NULL default '0', DROP INDEX clas...2013-05-20
帝国CMS登录后台提示"您的Cookie没有开启,不能登陆成功"的解决方法
如果没有动过文件特别是/e/config/config.php文件的话!请按照如下操作肯定就OK了! 到你的主机或者服务器环境里找到php.ini文件(如果不知道在哪联系你的空间商就行了) 找到如下...2016-05-19- /*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) php随机文章 方法1、WC写的高效随...2017-07-06
- /*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) 用灵动标签调用最新最多评论文章: [...2016-08-27
- 帝国CMS安装以及恢复数据模板视频教程,主要讲解了墨鱼出品的帝国CMS源码的安装以及数据库模板的回复过程,请大家注意视频里的一些操作细节。选择超清模式播放!...2016-05-08
帝国CMS灵动标签调用当前父栏目下所有子栏目-支持选中状态/高亮
帝国CMS实现灵动标签调用当前父栏目下所有子栏目-支持选中状态及当前栏目高亮,支持栏目自定义排序。最适用于内容模板,显示父栏目下的子栏目。 支持静态栏目页与动态栏目页 代...2016-05-19- 商品加入购物车链接地址为:[!--news.url--]e/ShopSys/doaction.php?enews=AddBuycar&classid=[!--classid--]&id=[!--id--]...2015-12-30
- 给帝国CMS任意模型加上百度地图标注功能。 第一步:首先在模型建立三个字段: 字段名:map_x 字段类型:DOUBLE 字段名:map_y 字段类型:DOUBLE 字段名:map_z 字段类型:TINYINT...2016-05-19
- 针对帝国CMS7.0:有得同学开启了后台登陆验证码,但是由于种种原因后台验证码没有显示,然而不填写验证码又无法登陆后台关闭后台验证码,墨鱼给同学们一个解决方案用工具(一定要用工...2016-05-08
- 因为帝国CMS 7.0信息页不再有ztid字段,所以直接是查询不到的,但是可以用灵动标签sql调用,具体调下方法如下:灵动标签sql调用:select ztid from phome_enewsztinfo where classid=...2015-12-30
- 任意页面动态调用购物车数量,不用刷新数据。 同时适用于帝国CMS6.6、7.0 新建一个buycarjs.php文件放在/e/shopsys/buycar/下,代码如下: <?phprequire("../../class/co...2016-05-19
- 您是不是期待此插件很久了,帝国论坛上终于有用户开发出来了,首先非常感谢他,在此我整理收集了过来,此插件非常适合一些信息发布的站点使用,如果您正好有此类站点,不凡试试看或许能...2015-12-30
- 6、下载不采用弹出窗口式说明 ...2016-05-19
- /*解决代码高亮太长不换行*/ .syntaxhighlighter{word-break:break-all;} uParse('#newstext', {rootPath: '/e/extend/ueditor/'}) 帝国cms简单修改实现TAGS以TAGID的方...2016-08-27
- 帝国CMS功能确实非常强大。但为啥子做个单页面就这么麻烦呢。 在论坛找了很久,一般来有以下几个方法: 一、其实栏目有个“页面内容式”。但悲催的是居然不支持绑...2016-05-19
- 帝国CMS7.0默认搜索模板不支持动态标签。通过以下方法可以实现搜索模板支持动态标签。修改 e/search/result/index.php 为以下代码:<?php require('../../class/connect.php'...2015-12-30