您好(hǎo),歡迎來(lái)到(dào)盤龍區華銘誠泰網絡工作室官↕ α 方網站(zhàn)!ZJJCL.CN
新聞動态
您現(xiàn)在的(de)位置:首頁 > 技(jì)術(shù)文(wén)摘
解決帝國(guó)CMS搜索頁面模闆不(bù)支持靈動≤σ标簽和(hé)萬能(néng)标簽的(de)方π☆ δ法
來(lái)源:創立工(gōng)作(zuò★δ∞)室 作(zuò)者:馮軍 發布時(shí)間(jiān):20≤×÷20-08-26 12:07:36 閱讀(dú)≈±'♦ 1267 次

1,打開(kāi) /e/search/resultπ"/index.php 文(wén)件(jiàn)

查找

require("../../class/connec•₽≥t.php");
require("../../c δφlass/db_sql.php");
require(".×δ./../data/dbcache/clas↓♠↑s.php");
require("../.®±./class/q_functions.©★€php");
require "../".LoadLang(♠♣"pub/fun.php");

修改為(wèi):

require('../../class/connect.p₹ hp');
require('../.© ./class/db_sql.php');
requir♦•→ e('../../class/functions.p₽✔₽₹hp');
require('../../class¶¶/t_functions.php');
₽>↓
require('../../data/dbcache/cla∞↓∞ ss.php');
require "../".LoadLang("pub/÷☆fun.php");

2,再查找

//替換公共模闆變量
$listtem×< p=$tempr[temptext];

在上(shàng)面添加如(rú)下(xià)代碼

//頁面支持标簽
$tempr[temptext]=DtNewsBq('liβ'∞ st'.$tempid,$tempr[temptext],0& );

修改完成,這(zhè)樣就(jiù)可(kě)以在搜索模闆中靈"∑✔®活使用(yòng)帝國(guó)cms強大(dà)的(d"♥£e)靈動和(hé)萬能(néng)标簽了(le)

下(xià)邊的(de)代碼直接覆蓋掉/e/search/result/in♥$£↔dex.php文(wén)件(jiàn)就(jiù)可(kě)以。

<?php
require("../♥δ"♠../class/connect.php");
require("../.&÷>>./class/db_sql.php");
require("../../d‌¥↔<ata/dbcache/class.php");
req¥∏↕₩uire('../../class/functions.php')★λ™;
require('../../class/t_funct§∞‌"ions.php');
require "../".<♦→LoadLang("pub/fun.php");
$editor=1;
e±"CheckCloseMods('sear₽♠↑←ch');//關閉模塊
$link=db_conn★☆ect();
$empire=new mysqlqu®∑"ery();
$getvar=$_GET['getva®↕r'];
if(empty($getvar))
{
★≈↓
    $getfrom="history.go(-1)";
}
δ↑<σ
else
{
    $getfrom="../../../se§↑arch/";
}
//搜索結果
$search ♣¶≤id=(int)$_GET['searchid'] →☆;
if(empty($searchid))
{
 <♥   printerror("SearchNotRecord"Ω←&,$getfrom,1);
}
$search_r=$×δempire->fetch1("selφ↔​'ect searchid,keyboard,±≠result_num,orderby,myor "der,tbname,tempid,andsql,trueclassid fr¶♣om {$dbtbpre}enewssearch where seβ‌↕γarchid='$searchid'");
if(empty($ ☆×search_r['searchid'])|​$|InfoIsInTable($search_r[tbn÷↔←¥ame]))
{
    printer←'εror("SearchNotRecord",$getfrom,1);
€≥✘}
$page=(int)$_GET['page'];≥±∑<
$page=RepPIntvar($page);
$start=0®♦λφ;
$page_line=$public_r[‍¥☆♦'search_pagenum'];//每頁顯示鏈接數(shù)
$≈≈line=$public_r['search_num'];//∞₩™每頁顯示記錄數(shù)
$offset=$p★&™αage*$line;//總偏移量
$s$←earch="&searchid=".$searchid;
$₽♦÷∞myorder=$search_r[orderby];
if‌​γ(empty($search_r[myorder]))
{
   ★↔∞ $myorder.=" desc";
}
$☆​♠add=stripSlashes($search_r['andsql'])★←;
$num=$search_r[res♦↓ult_num];
$query="selΩ♥ect * from {$dbtbpre}ecms_".$searc £h_r[tbname].($add?' where♠♥ '.substr($add,5):''§₩);
$query.=" order by ".$my♦€∏order." limit $offset,$line"©>↔;
$sql=$empire->query($query);
$li≈₹₩stpage=page1($num,$line,$p★¶'age_line,$start,$page,$search);
//取得↕π₽•(de)模闆
if($search_r♦‌✘['tempid'])
{
    $tempr=$empi≤¶re->fetch1("select temptext,↓'subnews,listvar,rownum,showdate,moδ♠'did,subtitle,docode frΩ✔↑∏om ".GetTemptb("enewssearch®"temp")." where tempid='".$searπ ☆ch_r['tempid']."' limit 1");​®δ
}
elseif(empty($class_r[$search_∑♦r[trueclassid]][searchte§♠φ×mpid]))
{
    $tempr=$empire-✔→>fetch1("select temptext,subne$¶δ₩ws,listvar,rownum,showdate,modid,subti≤♣&≤tle,docode from ".GetTemptb("enewssγ↔earchtemp")." where isdefa↓ ult=1 limit 1");
}
else®✔↑σ
{
    $tempr=$empire->f‌↓≤etch1("select temptext,subn•≤•©ews,listvar,rownum,showdβσ&ate,modid,subtitle,docode from ".Get♥α<Temptb("enewssearchtem•§p")." where tempid='".$cl↕$Ωass_r[$search_r[trueclassid]][se≤☆♠archtempid]."' limit 1");
}
✔×→$have_class=1;
//頁面支持标簽
$tempr[te≤∑∑mptext]=DtNewsBq('lis♠£‌&t'.$tempid,$tempr[temptext],0)♠π¥ ;
//替換公共模闆變量
$listte ★'mp=$tempr[temptext];
if($public_r['s∞↓γearchtempvar'])
{
    $listte‌≥☆¶mp=ReplaceTempvar($listtemp₽←↓←);
}
$search_r[keyb∞$<oard]=ehtmlspecialchars($search_r[ke∞∏yboard]);
$listtemp=s$¥£tr_replace("[!--show.pag↕γΩ&e--]",$listpage,$listtemp);
$listtemp§¶=str_replace("[!--key©¥≥♥board--]",$search_r[keyboar∞≤±↔d],$listtemp);
$listtemp=sφσ±®tr_replace("[!--ecms.nu•♦•m--]",$num,$listtemp);
$url="&↑​↕δlt;a href='".ReturnSiteIndexUrl(δ₩₹ )."'>".$fun_r['index']λ&←δ."</a> > ".$fun_r['adsearch'φ☆≥£];
$pagetitle=$fun_r['adsearch']." ".>∏π•$search_r[keyboard];
$listtemp=R'∏≤₩eplaceSvars($listtemp,$url,0,$pagetitl↕♦☆σe,$pagetitle,$pagetitle,$add,0);
♥≈
$rownum=$tempr[rownum];
if(em↑®pty($rownum))
{
    $rownum=1‌ ¥↓;
}
$formatdate=$tempr[sho€πwdate];
$subnews=$tempr[subnews];✔∏
$subtitle=$tempr[subtitle];
$do¶↕ code=$tempr[docode];
$modi✔"d=$tempr[modid];
$listvar=str_replac& ​₩e('[!--news.url--]',$public_♥♠r[newsurl],$tempr[listvar]);
//字♣↕Ω段
$ret_r=ReturnReplaceL♦↓₩✘istF($tempr[modid]);
//取♠©∞∑得(de)列表模闆
$list_exp="[!--σ <↕empirenews.listtemp--]";
$list_r₩€₩=explode($list_exp,$li✘≠γ©sttemp);
$listtext=$liδα$÷st_r[1];
$no=$offset+1;
$×≠•changerow=1;
while($r=$empire-&"¶αφgt;fetch($sql))
{
  ¶α↕  //替換列表變量
    $repvar=ReplaceListVar​×s($no,$listvar,$subnews,$subtitle,$foφλ≈rmatdate,$url,$have_class,$rεε™,$ret_r,$docode);
    $listtext=str&±×φ_replace("<!--list.var".$cha≠πngerow."-->",$repvar,$lis ±ttext);
    $change"∑₩≈row+=1;
    //超過行(x×✔∑íng)數(shù)
    if($changerow>$row↔♥δnum)
    {
        ‌>$changerow=1;
        $string.=$listt©&βΩext;
        $listtexσ×<→t=$list_r[1];
    }
   δβ£ $no++;
}
db_close();
$empire=null;
​'¥
//多(duō)餘數(shù)據
if($changΩ∞erow<=$rownum&& ββ ;$listtext<>$list_r[1])
{
    $≥"string.=$listtext;
}
$string=$liΩ∞st_r[0].$string.$list_r[2];↑♦
echo stripSlashes($string);
?>↑§★​