查找
require("../../class/connect.php");
r≥Ωequire("../../class/db_sql.∞€php");
require("../../data/dbcache/class.php");↑≈
require("../../class/q_fun'→ ctions.php");
require "../".LoadLang("'€∑≤pub/fun.php");
修改為(wèi):
require('../../class/connect.php');
require('../<₽../class/db_sql.php');
require('../∞α../class/functions.php');
r✔equire('../../class/t_functions.php');
σ
require('../../data/dbcache/class.φ↑php');
require "../".LoadLang("pub/fun.pΩ÷'"hp");
//替換公共模闆變量
$listtemp=$tempr[temptext];ε
在上(shàng)面添加如(rú)下(xià)代碼
//頁面支持标簽
$tempr[temptext]=≤★DtNewsBq('list'.$tempid,$tempr[t©λemptext],0);
修改完成,這(zhè)樣就(jiù)可(kě)以在搜索模闆中靈¥∏活使用(yòng)帝國(guó)cms強大(dà)的(de)靈動和(hé)σπ ↔萬能(néng)标簽了(le)
下(xià)邊的(de)代碼直接覆蓋掉/•e/search/result/index.php文(wén)件(jiàn)就(jiù)可(kě♥←ε)以。
<?php
require("../../>×class/connect.php");
require("../../class/dβ→♦∏b_sql.php");
require("..γ¥↔™/../data/dbcache/class.php");
req"®Ωuire('../../class/functions.php');
require('• ../../class/t_functions.php');
require "../".Lo¥♣☆adLang("pub/fun.php");
$editor=1;£
eCheckCloseMods('sea§δrch');//關閉模塊
$link=db_• connect();
$empire=ne¶∞♠≈w mysqlquery();
$getvar=$_GET['getvar'];
i≤≥↓δf(empty($getvar))
{
$getΩ from="history.go(-1)";
}
else
{
$getfr₹↔om="../../../search/"↕σ;
}
//搜索結果
$searchid=(int)$∏σ_GET['searchid'];
if(empty($s♣&↕↓earchid))
{
pr>₽interror("SearchNotRecord",$getfrom,1);
}
™☆ε♣$search_r=$empire->fetch1("✔"±select searchid,keyboard,result_num,orderby,myo®β≤§rder,tbname,tempid,andsql,trueclassid from €•{$dbtbpre}enewssearch where searchid='$searc&↓λ∏hid'");
if(empty($search_r['searchid']↕<)||InfoIsInTable($search_r[tbname]))ו
{
printerror("SearchNotRecord§≥β",$getfrom,1);
}
$page=(int)$_GE≤₹±T['page'];
$page=RepPIntvar($page);
$start=•≤ 0;
$page_line=$public_r <★™['search_pagenum'];//每頁顯示鏈接₹β∞ 數(shù)
$line=$publicα₽☆¶_r['search_num'];//每頁顯示記錄數(shù)
$offset=$page*$l ×Ω×ine;//總偏移量
$search="&searchid="→ ♠.$searchid;
$myorder=$search_r[orderby];✘•π
if(empty($search_r[myorder])) ¶↑
{
$myorder.=" desc";
}
∞¥δ•$add=stripSlashes($sea≠β₽rch_r['andsql']);
$num=$search_r[result_num];
≤
$query="select * from {$dbtbpre}ecms_".$search_rΩλ÷≤[tbname].($add?' where '.substr($ad>↓d,5):'');
$query.=" order by & ≤ ".$myorder." limit $offse≥∑®↕t,$line";
$sql=$empire≠->query($query);
$listpage=page1($num,$line≈≤,$page_line,$start,$page,$search);
//取得(de↕↓)模闆
if($search_r['tempid'])
{
$tempr=→±↕™$empire->fetch1("select temptext,subnews,li≤↕₹≤stvar,rownum,showdate♣≈,modid,subtitle,docode fro←↑m ".GetTemptb("enewssearchtemp")←δ." where tempid='".$search_r['tempi∏₹∞≤d']."' limit 1");
}
elseif(empty($class_r[$♦£search_r[trueclassid]][searchtem←δ'₩pid]))
{
$tempr=$empire->fetch1¶₽("select temptext,subnews,listvar,rownum,₽α•♦showdate,modid,subtitle,doco←" de from ".GetTemptb("enewssearchtem✔★p")." where isdefault=1 limit 1");
}
e≤&lse
{
$tempr=$empire->fetch1("select≥α temptext,subnews,listvar,rownum,showdate,mo✘÷did,subtitle,docode fr♣®om ".GetTemptb("enewssea<λrchtemp")." where tempid='".$class_r[ ∞ $search_r[trueclassid]][searchtempid®★δγ]."' limit 1");
}
$have_class=1;
//頁面支持标簽
Ω¶&
$tempr[temptext]=DtNews≠ βBq('list'.$tempid,$tempr[temptext],0);
//替換公共®φ模闆變量
$listtemp=$tempr[temptext];
i©™₹f($public_r['searchtempvar'])
{
$listtemp™®↓€=ReplaceTempvar($listtemp);
}
$search_r→↕←∏[keyboard]=ehtmlspecialchars($search_r[keyboar¶→↕d]);
$listtemp=str_replace("[®♥←≥!--show.page--]",$listpage,$listtemp)♦™×₹;
$listtemp=str_replace("[!--keyboard-φ♥-]",$search_r[keyboard],$listtemp);✘β
$listtemp=str_replace("[!--ecms.num--]",$nu£♣m,$listtemp);
$url="<a href='".ReturnSi™&αteIndexUrl()."'>".$fun_r['index']."</a>✔" > ".$fun_r['adsearch'];
₩$
$pagetitle=$fun_r['adsearch'↓ ]." ".$search_r[keyboard];
♥∞ε$listtemp=ReplaceSvars($listtemp,$url,≤★0,$pagetitle,$pagetitle,$pagetit♣φle,$add,0);
$rownum=$tempr[rownum];
γ♥γif(empty($rownum))
{
$rownum=1;
}
$format≈•λdate=$tempr[showdate];♣™≥
$subnews=$tempr[subnews];
$subtitl&∞e=$tempr[subtitle];
$docode=$tempr[doc♣♦ode];
$modid=$tempr[modid]≤↓•↔;
$listvar=str_replace('[!--☆¥•news.url--]',$public_r[newsurl],$tempr[list∑∑≥↔var]);
//字段
$ret_r=ReturnReplaceListF($t •≠ empr[modid]);
//取得(de)列表模闆
$list_exp=♥↕"[!--empirenews.listtemp--]";
$list_r=ex∏$σplode($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_rep>¥<lace("<!--list.var".$change<'row."-->",$repvar,$listtext);
€≈
$changerow+=1;
//超過行(xíng)數(shù)
Ω¥< if($changerow>$rownum)
{
$ch®↕®☆angerow=1;
$string.=$listtext;
∏☆φ $listtext=$list_r[1];
}
¥♠>$no++;
}
db_close();
$empire=null;
//多(duλō)餘數(shù)據
if($changerow•φ☆<=$rownum&&$l∞₽isttext<>$list_r[1])
{♣₽∏
$string.=$listtext;
}
$string=$list_r[0].®÷$string.$list_r[2];
ec→ε ho stripSlashes($string);☆♣
?>