代理加盟

2023全新代理计划,一站式模板建站,铜牌代理低至699元送终身VIP,独立代理后台,自营贴牌。

您现在的位置: 麦站网 > 站长学院 > 帝国教程 >

帝国cms搜索模板支持调用动态标签方法

来源:本站原创 发布时间:2020-07-01 21:39:30热度:646 ℃我要评论(0

麦站模板建站平台(10年经验),服务数万家企业,固定透明报价。域名注册、主机/服务器、网站源码一站式服务。实体公司,专业团队,值得选择!超过1000套模板已登记版权,合规合法建站,规避版权风险!【点击获取方案】

复制以下代码到e/search/result/index.php

001<?php
002 
003require('../../class/connect.php');
004 
005require('../../class/db_sql.php');
006 
007require('../../class/functions.php');
008 
009require('../../class/t_functions.php');
010 
011require('../../data/dbcache/class.php');
012 
013require "../".LoadLang("pub/fun.php");
014 
015$editor=1;
016 
017eCheckCloseMods('search');//关闭模块
018 
019$link=db_connect();
020 
021$empire=new mysqlquery();
022 
023$getvar=$_GET['getvar'];
024 
025if(empty($getvar)) {
026 
027        $getfrom="history.go(-1)";
028 
029} else {
030 
031        $getfrom="../../../search/";
032 
033}
034 
035//搜索结果
036 
037$searchid=(int)$_GET['searchid'];
038 
039if(empty($searchid)) {
040 
041        printerror("SearchNotRecord",$getfrom,1);
042 
043}
044 
045$search_r=$empire->fetch1("select searchid,keyboard,result_num,orderby,myorder,tbname,tempid,andsql,trueclassid from {$dbtbpre}enewssearch where searchid='$searchid'");
046 
047if(empty($search_r['searchid'])||InfoIsInTable($search_r[tbname])) {
048 
049        printerror("SearchNotRecord",$getfrom,1);
050 
051}
052 
053$page=(int)$_GET['page'];
054 
055$page=RepPIntvar($page);
056 
057$start=0;
058 
059$page_line=$public_r['search_pagenum'];//每页显示链接数
060 
061$line=$public_r['search_num'];//每页显示记录数
062 
063$offset=$page*$line;//总偏移量
064 
065$search="&searchid=".$searchid;
066 
067$myorder=$search_r[orderby];
068 
069if(empty($search_r[myorder])) {
070 
071        $myorder.=" desc";
072 
073}
074 
075$add=stripSlashes($search_r['andsql']);
076 
077$num=$search_r[result_num];
078 
079$query="select * from {$dbtbpre}ecms_".$search_r[tbname].($add?' where '.substr($add,5):'');
080 
081$query.=" order by ".$myorder." limit $offset,$line";
082 
083$sql=$empire->query($query);
084 
085$listpage=page1($num,$line,$page_line,$start,$page,$search);
086 
087//取得模板
088 
089if($search_r['tempid']) {
090 
091        $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$search_r['tempid']."' limit 1");
092 
093} elseif(empty($class_r[$search_r[trueclassid]][searchtempid])) {
094 
095        $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1");
096 
097} else {
098 
099        $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");
100 
101}
102 
103$have_class=1;//页面支持标签
104 
105$tempr[temptext]=DtNewsBq('listsearch'.$search_r['tempid'],$tempr[temptext],0);//替换公共模板变量
106 
107$listtemp=$tempr[temptext];
108 
109if($public_r['searchtempvar']) { $listtemp=ReplaceTempvar($listtemp);
110 
111}
112 
113$search_r[keyboard]=ehtmlspecialchars($search_r[keyboard]);
114 
115$listtemp=str_replace("[!--show.page--]",$listpage,$listtemp);
116 
117$listtemp=str_replace("[!--keyboard--]",$search_r[keyboard],$listtemp);
118 
119$listtemp=str_replace("[!--ecms.num--]",$num,$listtemp);
120 
121$url="<a href='".ReturnSiteIndexUrl()."'>".$fun_r['index']."</a>&nbsp;>&nbsp;".$fun_r['adsearch'];
122 
123$pagetitle=$fun_r['adsearch']." ".$search_r[keyboard];
124 
125$listtemp=ReplaceSvars($listtemp,$url,0,$pagetitle,$pagetitle,$pagetitle,$add,0);
126 
127$rownum=$tempr[rownum];
128 
129if(empty($rownum)) { $rownum=1;
130 
131}
132 
133$formatdate=$tempr[showdate];
134 
135$subnews=$tempr[subnews];
136 
137$subtitle=$tempr[subtitle];
138 
139$docode=$tempr[docode];
140 
141$modid=$tempr[modid];
142 
143$listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tempr[listvar]);
144 
145//字段
146 
147$ret_r=ReturnReplaceListF($tempr[modid]);
148 
149//取得列表模板
150 
151$list_exp="[!--empirenews.listtemp--]";
152 
153$list_r=explode($list_exp,$listtemp);
154 
155$listtext=$list_r[1];
156 
157$no=$offset+1;
158 
159$changerow=1;
160 
161while($r=$empire->fetch($sql)) {
162 
163        //替换列表变量
164 
165$repvar=ReplaceListVars($no,$listvar,$subnews,$subtitle,$formatdate,$url,$have_class,$r,$ret_r,$docode);
166 
167$listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
168 
169$listtext=str_replace($search_r[keyboard],"<font color='red'>$search_r[keyboard]</font>",$listtext);
170 
171$changerow+=1;
172 
173//超过行数
174 
175if($changerow>$rownum) {
176 
177$changerow=1;
178 
179$string.=$listtext;
180 
181$listtext=$list_r[1];
182 
183} $no++;
184 
185} db_close();
186 
187$empire=null;
188 
189//多余数据
190 
191if($changerow<=$rownum&&$listtext<>$list_r[1]) {
192 
193         $string.=$listtext;
194 
195}
196 
197$string=$list_r[0].$string.$list_r[2];
198 
199echo stripSlashes($string);
200 
201?>

 

    转载请注明来源网址:https://www.xiuzhanwang.com/empire_cms/2486.html

    发表评论

    评论列表(0条)

       
      QQ在线咨询
      VIP限时特惠