帝國(guó)cms簡(jiǎn)單修改實(shí)現(xiàn)TAGS以TAGID的方式偽靜態(tài),注:此方法已經(jīng)從帝國(guó)7.5原版測(cè)試通過(guò)!(本方法修改系統(tǒng)文件)
改后的地址形式如:/tags-100-0.html (數(shù)字100為TAG 的 ID)
第一步、打開/e/class/connect.php文件,找到
function eReturnRewriteTagsUrl($tagid,$tagname,$ecms=0){
global $public_r;
$tagname=urlencode($tagname);
if(empty($public_r['rewritetags']))
{
$r['pageurl']=$public_r['newsurl']."e/tags/?tagname=".$tagname;
$r['rewrite']=0;
}
else
{
if($ecms==1)
{
$r['pageurl']=$public_r['newsurl'].str_replace(array('[!--tagname--]','[!--page--]'),array($tagname,0),$public_r['rewritetags']);
}
else
{
$r['pageurl']=$public_r['newsurl'].str_replace('[!--tagname--]',$tagname,$public_r['rewritetags']);
}
$r['rewrite']=1;
}
return $r;
}
此函數(shù)整個(gè)修改為:
function eReturnRewriteTagsUrl($tagid,$tagname,$ecms=0){
global $public_r,$empire,$dbtbpre;
if(!$tagid){
$tagname=RepPostVar($tagname);
if(!$tagname)
{
$r['pageurl']=$public_r['newsurl'];
$r['rewrite']=0;
return $r;
}
$tagr=$empire->fetch1("select tagid,num from {$dbtbpre}enewstags where tagname='$tagname' limit 1");
if(!$tagr['tagid'])
{
$r['pageurl']=$public_r['newsurl'];
$r['rewrite']=0;
return $r;
}
$tagid=$tagr['tagid'];
}
if(empty($public_r['rewritetags']))
{
$r['pageurl']=$public_r['newsurl']."e/tags/?tagid=".$tagid;
$r['rewrite']=0;
}
else
{
if($ecms==1)
{
$r['pageurl']=$public_r['newsurl'].str_replace(array('[!--tagname--]','[!--page--]'),array($tagid,0),$public_r['rewritetags']);
}
else
{
$r['pageurl']=$public_r['newsurl'].str_replace('[!--tagname--]',$tagid,$public_r['rewritetags']);
}
$r['rewrite']=1;
}
return $r;
}
第二步、打開/e/tags/index.php文件
找到
if(!empty($public_r['rewritetags'])&&empty($add)&&($search=='&tagname='.$tagname.'&line='.$public_r['tagslistnum'].'&tempid='.$public_r['tagstempid']||$search=='&tagid='.$tagid.'&line='.$public_r['tagslistnum'].'&tempid='.$public_r['tagstempid'])&&!$myorder)
{
//偽靜態(tài)
$pagefunr=eReturnRewriteTagsUrl($tagid,$tagr['tagid']?$tagname:'etagid'.$tagid,0);
$pagefunr['repagenum']=0;
//分頁(yè)
if($pagefunr['rewrite']==1)
{
$listpage=InfoUsePage($num,$line,$page_line,$start,$page,$search,$pagefunr);
}
else
{
$listpage=page1($num,$line,$page_line,$start,$page,$search);
}
}
else
{
$listpage=page1($num,$line,$page_line,$start,$page,$search);//分頁(yè)
}
修改為:
/*
if(!empty($public_r['rewritetags'])&&empty($add)&&($search=='&tagname='.$tagname.'&line='.$public_r['tagslistnum'].'&tempid='.$public_r['tagstempid']||$search=='&tagid='.$tagid.'&line='.$public_r['tagslistnum'].'&tempid='.$public_r['tagstempid'])&&!$myorder)
{
*/
//偽靜態(tài)
$pagefunr=eReturnRewriteTagsUrl($tagid,$tagname,0);
$pagefunr['repagenum']=0;
//分頁(yè)
if($pagefunr['rewrite']==1)
{
$listpage=InfoUsePage($num,$line,$page_line,$start,$page,$search,$pagefunr);
}
else
{$listpage=page1($num,$line,$page_line,$start,$page,$search);
}
/*
}
else
{
$listpage=page1($num,$line,$page_line,$start,$page,$search);//分頁(yè)
}
*/
第三步:后臺(tái)設(shè)置tag偽靜態(tài)
按照默認(rèn),設(shè)置成:tags-[!--tagname--]-[!--page--].html 即可。
第四步:服務(wù)器偽靜態(tài)規(guī)則
apache的偽靜態(tài)規(guī)則如下,其它類型服務(wù)器請(qǐng)對(duì)照此自行修改:
RewriteRule ^tags-(.*)-(.*)$ e/tags/index.php?tagid=$1&page=$2
版權(quán)聲明: 本站資源均來(lái)自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請(qǐng)注明: 帝國(guó)cms修改實(shí)現(xiàn)TAG標(biāo)簽以TAGID的方式偽靜態(tài)