帝国cms7.2搜索页面支持灵动标签调用和多个模板搜索

修改esearchresult文件代码如下:

<?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"); $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'.$search_r['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("",$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('http://www.jzread.com/',$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); ?>

时间: 2024-10-30 03:33:42

帝国cms7.2搜索页面支持灵动标签调用和多个模板搜索的相关文章

如何让帝国CMS7.2搜索模板支持动态标签调用

帝国cms站内搜索一般不支持动态标签调用,如果要调用如何实现呢?修改两个地方就可以实现了.打开 /e/search/result/index.php 文件,找到(文件改了,不会调用也是徒劳!看看这个帝国cms搜索关键字调用标签(showsearch)怎么用) require("../../class/connect.php"); require("../../class/db_sql.php"); require("../../data/dbcache/c

帝国cms灵动标签调用discuz图文帖子加简介的方法

帝国cms灵动标签调用discuz图文帖子加简介的方法 [e:loop={"select tid,subject,dateline,digest  from dy.pre_forum_thread where digest!=0 order by tid desc limit 4",10,24,0}] <?php $fr=$empire->fetch1("select attachment from dy.pre_forum_threadimage where t

帝国cms 用灵动标签调用图片友情链接方法

众所周知帝国的友情链接调用标签生成出来的代码是Table的,不符合标准,所以我们用灵动标签调用友情链接. 代码: <ul class="links_text"> [e:loop={'select * from [!db.pre!]enewslink where checked=1 and lpic!="" order by lid',20,24,0}] <li><a href="<?=$bqr[lurl]?>&qu

帝国cms用灵动标签调用信息并带最新一条评论

如何用灵动标签调用信息,并调用这条信息的最新一条评论,答案如下: [e:loop={'selfinfo',10,0,0}]           //调用当前栏目下的最新10条信息 <?php $plb=$empire->fetch1("select * from phome_enewspl where id=".$bqr[id]); //查询当前信息所用的附表 $pla=$empire->fetch1("select saytext from phome_e

用灵动标签调用当前文章的“上一篇”和“下一篇”

用灵动标签调用当前文章的"上一篇"和"下一篇" 上一篇: [e:loop={"select * from [!db.pre!]ecms_表名 where id<'$navinfor[id]' and classid='$navinfor[classid]' and checked=1 order by id desc limit 1",1,24,0}] <a href="<?=$bqsr[titleurl]?>&

用帝国cms灵动标签调用当前栏目所有子栏目的方法

<?php $bclassid=$GLOBALS[navclassid]; //取得本栏目id //取得本栏目下的子栏目 ?> [e:loop={"select classid, classname, classpath from `[!db.pre!]enewsclass` where bclassid='$bclassid' order by `classid` desc ",5,24,0,0,0}] 这里加想循环的子栏目信息 子栏目名称:<?=$class_r[

帝国cms灵动标签调用discuz和phpwind的最新贴子

帝国cms调用Discuz最新贴子:cdb_是discuz的表前缀 <table width="100%" border="0" cellspacing="1" cellpadding="3"> [e:loop={"select tid,subject from cdb_threads order by tid desc limit 10",10,24,0}] <tr><td&

帝国cms用灵动标签调用循环子栏目的方法

<div class="sae_gl"> <?php $bclassid=$GLOBALS[navclassid];//取得本栏目id //取得本栏目下的子栏目 ?> [e:loop={"select classid, classname, classpath from `[!db.pre!]enewsclass` where bclassid='$bclassid' order by `classid` desc ",7,24,0}] &l

帝国cms 灵动标签调用标题的字体颜色方法

<?=DoTitleFont($bqr[titlefont],$bqr[title])?>这个可以显示标题颜色,但是又不能截取字数了 这个 <?=DoTitleFont($bqr[titlefont],esub($bqr[title],25))?> 既可以显示标题颜色,也可以截取字数了.