帝国cms 高级搜索表单模板 不支持标签另类解决方法


由于“高级搜索表单模板”是属于动态页面,因此需要打开“e/admin/ecmschtml.php”文件 


找到“ReDtPage($logininid,$loginin);”//批量更新动态页面;

再进入后,找到“Getsearch()”

//批量生成动态页面
function ReDtPage($userid,$username){
	//操作权限
	CheckLevel($userid,$username,$classid,"changedata");
	GetPlTempPage();//评论列表模板
	GetPlJsPage();//评论JS模板
	ReCptemp();//控制面板模板
	GetSearch();//三搜索表单模板
	GetPrintPage();//打印模板
	GetDownloadPage();//下载地址页面
	ReGbooktemp();//留言板模板
	ReLoginIframe();//登陆状态模板
	ReSchAlltemp();//全站搜索模板
	//操作日志
	insert_dolog("");
	printerror("ReDtPageSuccess","history.go(-1)");
}

然后进入到这个方法中,进行修改;

//生成搜索文件
function GetSearch($mid=0){
	global $empire,$public_r,$fun_r,$dbtbpre;
	//取得模板
	$tr=$empire->fetch1("select searchtemp,searchjstemp,searchjstemp1 from ".GetTemptb("enewspubtemp")." limit 1");
	//返回栏目搜索
	$fcfile="../data/fc/ListEnews.php";
	$fcjsfile="../data/fc/cmsclass.js";
	if(file_exists($fcjsfile)&&file_exists($fcfile))
	{
		$options=GetFcfiletext($fcjsfile);
	}
	else
	{
		$options=ShowClass_AddClass("","n",0,"|-",0,1);
	}
	//$options="<script src=".$public_r[newsurl]."e/data/fc/searchclass.js></script>";
	$functions="function search_check(obj){if(obj.keyboard.value.length==0){alert('".$fun_r['EmptyKey']."');return false;}return true;}";
	//横向搜索
	$searchjstemp=ReplaceStemp($tr[searchjstemp],$options,$url,0,'','','');
	$text2=$functions."document.write(\"".$searchjstemp."\");";
	//纵向搜索
	$searchjstemp1=ReplaceStemp($tr[searchjstemp1],$options,$url,0,'','','');
	$text3.=$functions."document.write(\"".$searchjstemp1."\");";
	//高级搜索
	$url="<a href='".ReturnSiteIndexUrl()."'>".$fun_r['index']."</a>&nbsp;>&nbsp;<a href='../search/'>".$fun_r['adsearch']."</a>&nbsp;>";//导航栏
	//搜索模板替换
	$dbsearchtemp=ReplaceStemp($tr[searchtemp],$options,$url,0,$fun_r['adsearch'],$fun_r['adsearch'],$fun_r['adsearch'],1);
	$text4=$dbsearchtemp;
	//增加信息栏目
	if($mid)
	{
		$options1=ShowClass_AddClass("","n",0,"|-",$mid,2);
		$addnews_class="document.write(\"".addslashes($options1)."\");";
		$filename3="../../d/js/js/addinfo".$mid.".js";
		WriteFiletext_n($filename3,$addnews_class);
    }
	$filename="../../d/js/js/search_news1.js";
	WriteFiletext_n($filename,$text2);
	$filename1="../../d/js/js/search_news2.js";
	WriteFiletext_n($filename1,$text3);
	$filename2="../../search/index".$public_r[searchtype];
	
	/****************************************************   begin 自己添加部分代码   **************************************************/
	
	
	$xpx_menustr="";
	$ptsql=$empire->query("select menuid,menuname,menuurl from {$dbtbpre}enewsmenu where classid=1 order by myorder,classid asc ");
	while($ptr=$empire->fetch($ptsql))
	{
		$classStr="menu".$ptr[menuid];
		$xpx_menustr.="<li><a href='".$ptr[menuurl]."'  target='_self' title='".$ptr[menuname]."'  id='".$classStr."'>".$ptr[menuname]."</a></li> ";
	}
	$xpx_remenshousuo="";
	$ptsql=$empire->query("select * from {$dbtbpre}enewstags order by num desc limit 10");
	while($ptr=$empire->fetch($ptsql))
	{ 
		$xpx_remenshousuo.="<a href='".$public_r[newsurl]."e/tags/?tagid=".$ptr[tagid]."' target='_blank'>".$ptr[tagname]."</a>&nbsp;&nbsp; ";
	}	
	$text4=str_replace("{!--xpx_menustr--}", $xpx_menustr, $text4);
	$text4=str_replace("{!--xpx_remenshousuo--}",$xpx_remenshousuo, $text4);
	
	
	/****************************************************    end 自己添加部分代码   **************************************************/
	
	
	WriteFiletext($filename2,$text4);
}

静态页面模板设置:

<!-- 导航tab选项卡 -->
<div class="menuDiv">
	<div class="menu">
    	<div class="wdiv">
        	<ul>


                {!--xpx_menustr--}


            </ul>
        </div>
    </div>
    <div class="menusub">
    	<div class="wdiv">
        	<b>热门搜索:</b>
                {!--xpx_remenshousuo--}
        </div>
    </div>
</div>

以上代码有温州天时网站建设提供;


以下小结下,搜索结果页不支持标签的处理方法:

<?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的留言板是动态页面,不支持万能标签、灵动标签等等一些标签。
在让留言板也支持这些标签的调用呢。
可以根据以下步骤更改:
一、查找e/class/functions.php这个文件里面的这串代码:
$gbtemp=str_replace("<!--empire.listtemp.footer-->",$listtemp_r[2],$gbtemp);
在这串代码之后 添加如下两串代码:
$gbtemp=DoRepEcmsLoopBq($gbtemp);
$gbtemp=RepBq($gbtemp);

二、再打开e/data/template/gbooktemp.txt这个文件
在头部require(“../../class/connect.php”);这串代码后面添加下面两串代码:
require("../../class/t_functions.php");
require("../../data/dbcache/class.php");


注:本文转载自拾图网[http://www.tshinet.com],转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如有侵权行为,请联系我们,我们会及时删除。
上一篇 下一篇

淘宝热销

  • Mistine小黄帽防晒霜乳SPF50泰版面部防紫外线隔离男女军训蜜丝婷

    【推荐理由】赠运费险

    【优惠券】20   【券后价】59.00

    【下单链接】18¥ CZ0001 G5fHdEqOsnB¥

    >>>>>> 马上打开

  • G7旗舰店越南进口美式纯黑咖啡粉速溶无糖0脂减燃正品学生提神

    【推荐理由】库存紧张,好评过万

    【优惠券】3    【券后价】26.90

    【下单链接】27¥ CZ0001 zb0bdEqLV7G¥

    >>>>>> 马上打开