ucbug軟件站:安全、綠色、放心的專業(yè)下載站!首頁|最近更新|專題集合|標(biāo)簽云|站內(nèi)導(dǎo)航|加入收藏

《帝國cms》tags偽靜態(tài)實現(xiàn)方法介紹

時間:2018-01-03 15:53:43來源:ucbug游戲網(wǎng)人氣:0

帝國cms網(wǎng)站優(yōu)化值tags偽靜態(tài)的實現(xiàn)步驟如下:∵1.修改e/class/t_functions.php中的sys_eShowTags函數(shù)∵代碼如下:∵//顯示TAGS∵function∵sys_eShowTags($cid,$num=0,$line=0,$order=,$isgood=,$isgoodshow=,$showjg=,$shownum=0,$c...

帝國cms網(wǎng)站優(yōu)化值tags偽靜態(tài)的實現(xiàn)步驟如下:

1.修改e/class/t_functions.php中的sys_eShowTags函數(shù)

代碼如下:

//顯示TAGS
function sys_eShowTags($cid,$num=0,$line=0,$order='',$isgood='',$isgoodshow='',$showjg='',$shownum=0,$cs=''){
global $empire,$dbtbpre,$public_r,$navinfor;
$str='';
if(empty($showjg))
{
$showjg=' ';
}
$ln=0;
if($cid=='selfinfo')
{
if(empty($navinfor['infotags']))
{
return '';
}
$jg='';
$r=explode(',',$navinfor['infotags']);
$count=count($r);
for($i=0;$i<$count;$i++)
{
$ln++;
$br='';
if($line)
{
if($ln%$line==0)
{
$br='
';
}
}
$str.=$jg.''.$r[$i].''.$br;
$jg=$br?'':$showjg;
}
}
else
{
$and='';
$where='';
if($cid)
{
$where=strstr($cid,',')?"cid in ($cid)":"cid='$cid'";
$and=' and ';
}
if($isgood)
{
$where.=$and.'isgood=1';
}
if($where)
{
$where=' where '.$where;
}
$order=$order?' '.$order:' tagid desc';
$limit='';
if($num)
{
$limit=' limit '.$num;
}
//推薦標(biāo)紅
$gfont1='';
$gfont2='';
if($isgoodshow)
{
if(strstr($isgoodshow,'r'))
{
$gfont1='';
$gfont2='';
}
if(strstr($isgoodshow,'s'))
{
$gfont1=$gfont1.'';
$gfont2=''.$gfont2;
}
}
$jg='';
$snum='';
$sql=$empire->query("select tagid,tagname,num,isgood from {$dbtbpre}enewstags".$where." order by".$order.$limit);
while($r=$empire->fetch($sql))
{
if($shownum)
{
$snum='('.$r[num].')';
}
$font1='';
$font2='';
if($isgoodshow&&$r[isgood])
{
$font1=$gfont1;
$font2=$gfont2;
}
$ln++;
$br='';
if($line)
{
if($ln%$line==0)
{
$br='
';
}
}
//$str.=$jg.''.$font1.$r[tagname].$snum.$font2.''.$br;
$str.=$jg.''.$font1.$r[tagname].$snum.$font2.''.$br;
$jg=$br?'':$showjg;
}
}
echo $str;
}

2.網(wǎng)站根目錄 增加.htaccess文件,內(nèi)容如下

代碼如下:

RewriteEngine On
RewriteBase /
RewriteRule tag/(.*).html$ e/tags/?tagname=$1
RewriteRule e/tags/(.*).html$ e/tags/?tagid=$1

還要空間支持偽靜態(tài)

1.檢測Apache是否支持mod_rewrite 通過php提供的phpinfo()函數(shù)查看環(huán)境配置,通過Ctrl+F查找到“Loaded Modules”,其中列出了所有apache2handler已經(jīng)開啟的模塊,如果里面包括“mod_rewrite”,則已經(jīng)支持,不再需要繼續(xù)設(shè)置。
如果沒有開啟“mod_rewrite”,則打開目錄 您的apache安裝目錄“/apache/conf/” 下的 httpd.conf 文件,通過Ctrl+F查找到“LoadModule rewrite_module”,將前面的”#”號刪除即可。
如果沒有查找到,則到“LoadModule” 區(qū)域,在最后一行加入“LoadModule rewrite_module modules/mod_rewrite.so”(必選獨占一行),然后重啟apache服務(wù)器即可。

2.讓apache服務(wù)器支持.htaccess

修改httpd.conf文件

代碼如下:
Options FollowSymLinks
AllowOverride None
改為
代碼如下:
Options FollowSymLinks
AllowOverride All
標(biāo)簽帝國cms