国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > CMS > 織夢(mèng)DEDE > 正文

DedeCMS實(shí)現(xiàn)tag標(biāo)簽偽靜態(tài)的方法

2024-07-12 09:03:07
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

目標(biāo):使DEDECMS原來(lái)的tags.php?/bnxbcom/  變動(dòng)為/tags/bnxbcom.html 這種偽靜態(tài)模式

一、dede后臺(tái)開(kāi)啟偽靜態(tài)


二、修改 /include/taglib/tag.lib.php

大約87行找到


$row['link'] = $cfg_cmsurl."/tags.php?/".urlencode($row['keyword'])."/";

改成


$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword']).".html";

 

三、修改分頁(yè)代碼

修改分頁(yè)代碼。同樣打開(kāi)include/arc.taglist.class.php,主要是//獲得上一頁(yè)和下一頁(yè)的鏈接。將//獲得上一頁(yè)和下一頁(yè)的鏈接  至  //獲得數(shù)字鏈接之間的分頁(yè)函數(shù)替換:

也可以直接用下面代碼替換同樣部分代碼

(提示:網(wǎng)上有文章中講的以下代碼中的"pageinfo"是錯(cuò)誤的,應(yīng)該為/"pageinfo/",不然會(huì)有錯(cuò)誤提示哦!已經(jīng)代碼測(cè)試OK!)

 

/**&nbsp;*&nbsp;獲取動(dòng)態(tài)的分頁(yè)列表** @access public* @param int $list_len 列表寬度* @param string $listitem 列表樣式* @return string*/function GetPageListDM($list_len,$listitem="info,index,end,pre,next,pageno"){$prepage="";$nextpage="";$prepagenum = $this->PageNo - 1;$nextpagenum = $this->PageNo + 1;if($list_len == "" || preg_match("/[^0-9]/", $list_len)){$list_len = 3;}$totalpage = $this->TotalPage;if($totalpage <= 1 && $this->TotalResult > 0){return "<span class=/"pageinfo/">共1頁(yè)/".$this->TotalResult."條</span>";}if($this->TotalResult == 0){return "<span class=/"pageinfo/">共0頁(yè)/".$this->TotalResult."條</span>";}$maininfo = "<span class=/"pageinfo/">共{$totalpage}頁(yè)/".$this->TotalResult."條</span>rn";$purl = $this->GetCurUrl();$basename = basename($purl);$tmpname = explode('.', $basename);$purl = str_replace($basename, '', $purl).urlencode($this->Tag);//var_dump($purl);exit;//$purl .= "?/".urlencode($this->Tag);//獲得上一頁(yè)和下一頁(yè)的鏈接if($this->PageNo != 1){$prepage.="<li><a href='".$purl."-$prepagenum'.html>上一頁(yè)</a></li>rn";$indexpage="<li><a href='".$purl."-1.html'>首頁(yè)</a></li>rn";}else{$indexpage="<li><a>首頁(yè)</a></li>rn";}if($this->PageNo!=$totalpage && $totalpage>1){$nextpage.="<li><a href='".$purl."-$nextpagenum.html'>下一頁(yè)</a></li>rn";$endpage="<li><a href='".$purl."-$totalpage.html'>末頁(yè)</a></li>rn";}else{$endpage="<li><a>末頁(yè)</a></li>rn";}//獲得數(shù)字鏈接$listdd="";$total_list = $list_len * 2 + 1;if($this->PageNo >= $total_list){$j = $this->PageNo - $list_len;$total_list = $this->PageNo + $list_len;if($total_list > $totalpage){$total_list = $totalpage;}}else{$j=1;if($total_list > $totalpage){$total_list = $totalpage;}}for($j; $j<=$total_list; $j++){if($j == $this->PageNo){$listdd.= "<li class=/"thisclass/"><a>$j</a></li>rn";}else{$listdd.="<li><a href='".$purl."-$j.html'>".$j."</a></li>rn";}}$plist = '';if(preg_match('/info/i', $listitem)){$plist .= $maininfo.' ';}if(preg_match('/index/i', $listitem)){$plist .= $indexpage.' ';}if(preg_match('/pre/i', $listitem)){$plist .= $prepage.' ';}if(preg_match('/pageno/i', $listitem)){$plist .= $listdd.' ';}if(preg_match('/next/i', $listitem)){$plist .= $nextpage.' ';}if(preg_match('/end/i', $listitem)){$plist .= $endpage.' ';}return $plist;}

 

四、打開(kāi)templets/default/taglist.htm

找到   

<strong>當(dāng)前位置:</strong>:<a href="{dede:global.cfg_cmsurl/}/">主頁(yè)</a> &gt; <a href='tags.php'>TAG標(biāo)簽</a> &gt; {dede:field.title /}

修改為    

<strong>當(dāng)前位置:</strong>:<a href="{dede:global.cfg_cmsurl/}/">主頁(yè)</a> &gt; <a href='/tags.html'>TAG標(biāo)簽</a> &gt; {dede:field.title /}

五、httpd.ini 文件里加


 

RewriteRule ^(.*)/tags/.html $1/tags/.phpRewriteRule ^(.*)/tags/(.*).html $1/tags/.php/?$2如果是HTACCESS,那使用下面規(guī)則RewriteEngine onRewriteBase /RewriteRule ^tags/([0-9]+)_([0-9]+).html$        tags.php?tagid=$1&PageNo=$2 [L]RewriteRule ^tags/([0-9]+).html$                tags.php?tagid=$1 [L]

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 个旧市| 安徽省| 磐石市| 航空| 正蓝旗| 诸城市| 闸北区| 广饶县| 赞皇县| 静宁县| 民县| 江安县| 合作市| 如皋市| 柘城县| 东海县| 水城县| 景德镇市| 漾濞| 济阳县| 汝阳县| 榕江县| 安远县| 巍山| 平昌县| 家居| 正阳县| 罗定市| 忻州市| 靖江市| 青河县| 崇信县| 胶州市| 凉山| 云南省| 眉山市| 漳平市| 夏河县| 开阳县| 夏河县| 华阴市|