主頁 > 網(wǎng)站建設(shè) > 建站知識(shí) > dedecms 5.5 偽靜態(tài)化ReWrite規(guī)則

dedecms 5.5 偽靜態(tài)化ReWrite規(guī)則

POST TIME:2019-09-30 17:38

個(gè)人修改記錄,不一定適合大眾.
列表命名規(guī)則:

代碼如下:
/list/list-{tid}-{page}.html

文章命名規(guī)則:

代碼如下:
/test/{Y}{M}/{aid}.html

.htaccess

代碼如下:
RewriteRule ^([a-zA-Z]+)/([0-9]+)/([0-9]+).html$ /plus/view.php?arcID=$3
RewriteRule ^([a-zA-Z]+)/([0-9]+)/([0-9]+)-([0-9]+).html$ /plus/view.php?aid=$3&pageno=$4

include/arc.archives.class.php

代碼如下:
//獲得動(dòng)態(tài)頁面分頁列表
function GetPagebreakDM($totalPage,$nowPage,$aid)
{
global $cfg_rewrite;
if($totalPage==1)
{
return “”;
}
$PageList = “<li><a>共”.$totalPage.”頁: </a></li>”;
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1)
{
$PageList.=”<li><a href=’#'>上一頁</a></li>”;
}
else
{
if($nPage==1)
{
$PageList.=”<li><a href=’view.php?aid=$aid’>上一頁</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = preg_replace(“/view.php?aid=(d+)/i”,’-\1-1.html’,$PageList);
}
}
else
{
$PageList.=”<li><a href=’view.php?aid=$aid&pageno=$nPage’>上一頁</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = str_replace(“view.php?aid=”,“”,$PageList);
$PageList = preg_replace(“/&pageno=(d+)/i”,’-\1.html’,$PageList);
}
}
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1)
{
if($nowPage!=1)
{
$PageList.=”<li><a href=’view.php?aid=$aid’>1</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = preg_replace(“/view.php?aid=(d+)/i”,’-\1-1.html’,$PageList);
}
}
else
{
$PageList.=”<li class=&;thisclass&;><a>1</a></li>”;
}
}
else
{
$n = $i;
if($nowPage!=$i)
{
$PageList.=”<li><a href=’view.php?aid=$aid&pageno=$i’>”.$n.”</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = str_replace(“view.php?aid=”,“”,$PageList);
$PageList = preg_replace(“/&pageno=(d+)/i”,’-\1.html’,$PageList);
}
}
else
{
$PageList.=”<li class=&;thisclass&;><a href=’#'>{$n}</a></li>”;
}
}
}
if($lPage <= $totalPage)
{
$PageList.=”<li><a href=’view.php?aid=$aid&pageno=$lPage’>下一頁</a></li>”;
if($cfg_rewrite == ‘Y’)
{
$PageList = str_replace(“view.php?aid=”,“”,$PageList);
$PageList = preg_replace(“/&pageno=(d+)/i”,’-\1.html’,$PageList);
}
}
else
{
$PageList.= “<li><a href=’#'>下一頁</a></li>”;
}
return $PageList;
}
//獲得靜態(tài)頁面分頁列表
function GetPagebreak($totalPage,$nowPage,$aid)
{
if($totalPage==1)
{
return “”;
}
$PageList = “<li><a>共”.$totalPage.”頁: </a></li>”;
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1)
{
$PageList.=”<li><a href=’#'>上一頁</a></li>”;
}
else
{
if($nPage==1)
{
$PageList.=”<li><a href=’”.$this->NameFirst.”.”.$this->ShortName.”‘>上一頁</a></li>”;
}
else
{
$PageList.=”<li><a href=’”.$this->NameFirst.“-”.$nPage.”.”.$this->ShortName.”‘>上一頁</a></li>”;
}
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1)
{
if($nowPage!=1)
{
$PageList.=”<li><a href=’”.$this->NameFirst.”.”.$this->ShortName.”‘>1</a></li>”;
}
else
{
$PageList.=”<li class=&;thisclass&;><a href=’#'>1</a></li>”;
}
}
else
{
$n = $i;
if($nowPage!=$i)
{
$PageList.=”<li><a href=’”.$this->NameFirst.“-”.$i.”.”.$this->ShortName.”‘>”.$n.”</a></li>”;
}
else
{
$PageList.=”<li class=&;thisclass&;><a href=’#'>{$n}</a></li>”;
}
}
}
if($lPage <= $totalPage)
{
$PageList.=”<li><a href=’”.$this->NameFirst.“-”.$lPage.”.”.$this->ShortName.”‘>下一頁</a></li>”;
}
else
{
$PageList.= “<li><a href=’#'>下一頁</a></li>”;
}
return $PageList;
}

include/arc.listview.class.php

代碼如下:
$plist = str_replace(‘&TotalResult=’, ‘-’, $plist);

去除動(dòng)態(tài)列表網(wǎng)址里帶有列表的文章總數(shù)

代碼如下:
$plist = preg_replace(“/&TotalResult=(d+)/i”, ”, $plist);
 


收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266