王国CMS多频道检索完成启用不一样模板

2021-03-02 20:53 admin
多频道   检索
 ?php
require('../../');
require('../../');
require('../../');
require('../../');
require('../../data/');
require "../".LoadLang("");
$editor=1;
eCheckCloseMods('search');//关掉控制模块
$link=db_connect();
$empire=new mysqlquery();
$getvar=$_GET['getvar'];
if(empty($getvar))
 $getfrom="history.go(-1)";
 $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'];
$ar($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,ar,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,ar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1");
 $tempr=$empire- fetch1("select temptext,ar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$class_r[$search_r[trueclassid]][searchtempid]."' limit 1");
$have_ 'list'.$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],$ar]);
$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;
 //超出行数
 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);

 form action="/e/" method="post" name="searchform" id="searchform" 
 input name="keyboard" id="keyboard" value="请键入重要字词" onfocus="if(value=='请键入重要字词'){this.style.color='#000';value=''}"
 onblur="if(value==''){this.style.color='#999';value='请键入重要字词'}" type="text" 
 input name="show" value="title" type="hidden" 
 input name="tempid" value="1" type="hidden" //应用的模板ID,在模版-》检索模版-》管理方法检索模版,中能看到这一ID,能够建好几套模版,用ID指用就可以,这儿我用的是2号ID模版
 input name="tbname" value="news" type="hidden" 
 input type="hidden" name="classid" value="3,12" //它是指要检索的栏ID,能够是好几个,例如我用的是3,12即便用频道ID为3和12...

 /form 
最终:王国CMS较为完善,多方面資源也较为多,灵活运用好百度搜索,即可处理许多难题,可是总体来讲還是必须有基本才行,要不然也是一头雾水,将会不象完美CMS与PBCMS这么简单,大部分调标识便可以了。