溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何調(diào)用帝國CMS7.2搜索模板支持動態(tài)標(biāo)簽

發(fā)布時間:2020-08-04 10:45:28 來源:億速云 閱讀:157 作者:Leah 欄目:建站服務(wù)器

如何調(diào)用帝國CMS7.2搜索模板支持動態(tài)標(biāo)簽?針對這個問題,這篇文章詳細(xì)介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

帝國cms站內(nèi)搜索一般不支持動態(tài)標(biāo)簽調(diào)用,如果要調(diào)用如何實(shí)現(xiàn)呢?修改兩個地方就可以實(shí)現(xiàn)了。打開 /e/search/result/index.php 文件,找到(文件改了,不會調(diào)用也是徒勞?。?/p>

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");

接著查找:

//替換公共模板變量
$listtemp=$tempr[temptext];

在上面添加以下代碼:

//頁面支持標(biāo)簽
$tempr[temptext]=DtNewsBq('list'.$tempid,$tempr[temptext],0);

  ytkah早就猜到你不想去一行行找了,哈哈,直接提供修改后的整個代碼如下

<?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');//關(guān)閉模塊
$link=db_connect();
$empire=new mysqlquery();
$getvar=$_GET['getvar'];
if(empty($getvar))
{
    $getfrom="history.go(-1)";
}
else
{
    $getfrom="../../../search/";
}
//搜索結(jié)果
$searchid=(int)$_GET['searchid'];
if(empty($searchid))
{
    printerror("SearchNotRecord",$getfrom,1);
}
$search_r=$empire->fetch2("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'];//每頁顯示鏈接數(shù)
$line=$public_r['search_num'];//每頁顯示記錄數(shù)
$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->fetch2("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->fetch2("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1");
}
else
{
    $tempr=$empire->fetch2("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;
//頁面支持標(biāo)簽
$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>&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('[!--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;
    //超過行數(shù)
    if($changerow>$rownum)
    {
        $changerow=1;
        $string.=$listtext;
        $listtext=$list_r[1];
    }
    $no++;
}
db_close();
$empire=null;
//多余數(shù)據(jù)
if($changerow<=$rownum&&$listtext<>$list_r[1])
{
    $string.=$listtext;
}
$string=$list_r[0].$string.$list_r[2];
echo stripSlashes($string);
?>

關(guān)于如何調(diào)用帝國CMS7.2搜索模板支持動態(tài)標(biāo)簽問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI