日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

織夢cms系統(tǒng)TAG標簽和分頁偽靜態(tài)設置教程_DedeCms教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!
織夢cms系統(tǒng)TAG標簽和分頁偽靜態(tài)設置教程
現(xiàn)在好多CMS系統(tǒng)都有TAGS標簽這項功能,知名的DEDECMS也有,但是它的標簽功能很差,不利于seo優(yōu)化,同時也有很多問題,比如:當前頁不存在上一頁時,鏈接為“-1”的問題,還有出現(xiàn)“系統(tǒng)無此標簽,可能已經(jīng)移除”的問題。
 
今天小編就教大家把標簽偽靜態(tài)(部分資料來源于網(wǎng)絡),同時也修復了一些上述提到的BUG。
 
1.修改前臺顯示鏈接 
 
我們這里達到的效果就是使原來/tags.php?keywors更改為/tags/keywords.html。 
 
這里主要修改下調(diào)用的標簽,在/include/taglib/tag.lib.php中,在87行找到 
  1. $row['link'] = $cfg_cmsurl."/tags?".urlencode($row['keyword']);  
將其改為: 
  1. $row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword']).".html"; 
2.修改分頁代碼部分
 
我們需要修改include/arc.taglist.class.php,找到分頁函數(shù),將其替換為:
  1.  /** 
  2.  * 獲取動態(tài)的分頁列表 
  3.  * 
  4.  * @access public 
  5.  * @param int $list_len 列表寬度 
  6.  * @param string $listitem 列表樣式 
  7.  * @return string 
  8.  */ 
  9.  function GetPageListDM($list_len,$listitem="info,index,end,pre,next,pageno"
  10.  { 
  11.  $prepage=""
  12.  $nextpage=""
  13.  $prepagenum = $this->PageNo - 1; 
  14.  $nextpagenum = $this->PageNo + 1; 
  15.  if($list_len == "" || preg_match("/[^0-9]/", $list_len)) 
  16.  { 
  17.  $list_len = 3
  18.  } 
  19.  $totalpage = $this->TotalPage; 
  20.  if($totalpage <= 1 && $this->TotalResult > 0) 
  21.  { 
  22.  return "<span class=\"pageinfo\">共1頁/".$this->TotalResult."條</span>"; 
  23.  } 
  24.  if($this->TotalResult == 0) 
  25.  { 
  26.  return "<span class=\"pageinfo\">共0頁/".$this->TotalResult."條</span>"; 
  27.  } 
  28.  $maininfo = "<span class=\"pageinfo\">共{$totalpage}頁/".$this->TotalResult."條</span>\r\n"; 
  29.  $purl = $this->GetCurUrl(); 
  30.  $basenamebasename = basename($purl); 
  31.  $tmpname = explode('.', $basename); 
  32.  
  33.  $purl = str_replace($basename, '', $purl).urlencode($this->Tag); 
  34.  //var_dump($purl);exit; 
  35.  //$purl ."?/".urlencode($this->Tag); 
  36.  
  37.  //獲得上一頁和下一頁的鏈接 
  38.  //if($this->PageNo != 1) 這是修正上一頁為負數(shù)的問題 
  39.          if($this->PageNo != 1 && $this->PageNo != "") 
  40.  { 
  41.  $prepage.="<li><a href='".$purl."-$prepagenum'.html>上一頁</a></li>\r\n"; 
  42.  $indexpage="<li><a href='".$purl."-1.html'>首頁</a></li>\r\n"; 
  43.  } 
  44.  else 
  45.  { 
  46.  $indexpage="<li><a>首頁</a></li>\r\n"
  47.  } 
  48.  if($this->PageNo!=$totalpage && $totalpage>1) 
  49.  { 
  50.  $nextpage.="<li><a href='".$purl."-$nextpagenum.html'>下一頁</a></li>\r\n"; 
  51.  $endpage="<li><a href='".$purl."-$totalpage.html'>末頁</a></li>\r\n"; 
  52.  } 
  53.  else 
  54.  { 
  55.  $endpage="<li><a>末頁</a></li>\r\n"
  56.  } 
  57.  
  58.  //獲得數(shù)字鏈接 
  59.  $listdd=""
  60.  $total_list = $list_len * 2 + 1; 
  61.  if($this->PageNo >= $total_list) 
  62.  { 
  63.  $j = $this->PageNo - $list_len; 
  64.  $total_list = $this->PageNo + $list_len; 
  65.  if($total_list > $totalpage) 
  66.  { 
  67.  $total_list = $totalpage; 
  68.  } 
  69.  } 
  70.  else 
  71.  { 
  72.  $j=1
  73.  if($total_list > $totalpage) 
  74.  { 
  75.  $total_list = $totalpage; 
  76.  } 
  77.  } 
  78.  for($j; $j<=$total_list; $j++) 
  79.  { 
  80.  if($j == $this->PageNo) 
  81.  { 
  82.  $listdd.= "<li class=\"thisclass\"><a>$j</a></li>\r\n"; 
  83.  } 
  84.  else 
  85.  { 
  86.  $listdd.="<li><a href='".$purl."-$j.html'>".$j."</a></li>\r\n"; 
  87.  } 
  88.  } 
  89.  $plist = ''
  90.  if(preg_match('/info/i', $listitem)) 
  91.  { 
  92.  $plist .= $maininfo.' '; 
  93.  } 
  94.  if(preg_match('/index/i', $listitem)) 
  95.  { 
  96.  $plist .= $indexpage.' '; 
  97.  } 
  98.  if(preg_match('/pre/i', $listitem)) 
  99.  { 
  100.  $plist .= $prepage.' '; 
  101.  } 
  102.  if(preg_match('/pageno/i', $listitem)) 
  103.  { 
  104.  $plist .= $listdd.' '; 
  105.  } 
  106.  if(preg_match('/next/i', $listitem)) 
  107.  { 
  108.  $plist .= $nextpage.' '; 
  109.  } 
  110.  if(preg_match('/end/i', $listitem)) 
  111.  { 
  112.  $plist .= $endpage.' '; 
  113.  } 
  114.  return $plist; 
  115.  } 
  116.  3.設置偽靜態(tài)規(guī)則 
  117.  
  118.  我們這里以iis7為例子,設置以下規(guī)則: 
  119.  
  120.  Copy to ClipboardLiehuo.Net Codes引用的內(nèi)容:[www.veryhuo.com] 
  121.  <?xml version="1.0" encoding="UTF-8"?> 
  122.  <configuration> 
  123.  <system.webServer> 
  124.  <rewrite> 
  125.  <rules> 
  126.  <rule name="weather1" stopProcessing="true"> 
  127.  <match url="tags/([^-]+)\.html$" ignoreCase="true" /> 
  128.  <conditions logicalGrouping="MatchAll"> 
  129.  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
  130.  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
  131.  </conditions> 
  132. 132 
  133. 132 <action type="Rewrite" url="/tags.php?/{R:1}" appendQueryString="false" /> 
  134.  </rule> 
  135.  <rule name="weather2" stopProcessing="true"> 
  136.  <match url="tags/([^-]+)-([0-9]+)\.html$" ignoreCase="true" /> 
  137.  <conditions logicalGrouping="MatchAll"> 
  138.  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
  139.  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
  140.  </conditions> 
  141.  <action type="Rewrite" url="/tags.php?/{R:1}/{R:2}" appendQueryString="false" /> 
  142.  </rule> 
  143.  </rules> 
  144.  </rewrite> 
  145.  </system.webServer> 
  146.  </configuration> 
好了,至此就搞定了。僅供參考學習哦~
 

查看更多 DedeCms教程  織夢模板  織夢DedeCms視頻教程  織夢dedecms專題

來源:模板無憂//所屬分類:DedeCms教程/更新時間:2020-06-05
相關DedeCms教程