最新公告
  • 欢迎您光临站长模版网,本站秉承服务宗旨 履行“站长”责任,销售只是起点 服务永无止境!立即加入钻石VIP
  • 帝国CMS搜索模板支持动态标签调用

    正文概述 管理员   2024-04-11   18

    打开/e/search/result/index.php文件查找:

    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];

    在上面添加以下代码

    //页面支持标签
    $tempr[temptext]=DtNewsBq('list'.$tempid,$tempr[temptext],0);

    你也可以直接复制下面的代码直接替换/e/search/result/index.php文件

    <?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('listsearch'.$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("[!--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);
    $listtext=str_replace($search_r[keyboard],"<font color='red'>$search_r[keyboard]</font>",$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);
    ?>


    站长模版网 » 帝国CMS搜索模板支持动态标签调用

    常见问题FAQ

    免费下载或者VIP会员专享资源能否直接商用?
    本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
    提示下载完但解压或打开不了?
    最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,若小于网盘提示的容量则是这个原因。这是浏览器下载的bug,建议用百度网盘软件或迅雷下载。若排除这种情况,可在对应资源底部留言,或 联络我们.。
    找不到素材资源介绍文章里的示例图片?
    对于PPT,KEY,Mockups,APP,网页模版等类型的素材,文章内用于介绍的图片通常并不包含在对应可供下载素材包内。这些相关商业图片需另外购买,且本站不负责(也没有办法)找到出处。 同样地一些字体文件也是这种情况,但部分素材会在素材包内有一份字体下载链接清单。
    模板不会安装或需要功能定制以及二次开发?
    请QQ联系我们

    发表评论

    如需帝国cms功能定制以及二次开发请联系我们

    联系作者

    请选择支付方式

    ×
    支付宝支付
    余额支付
    ×
    微信扫码支付 0 元