//获得伪静态页面分页列表
function GetPagebreakDM($totalPage,$nowPage,$aid)
{
if($totalPage==1){ return ""; }
$PageList = "共".$totalPage."页: ";
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1) $PageList.="上一页 ";
else{
if($nPage==1) $PageList.="<a href='view-$aid'>上一页</a> ";
else $PageList.="<a href='view-$aid-$nPage.html'>上一页</a> ";
}
for($i=1;$i<=$totalPage;$i++)
{
if($i==1){
if($nowPage!=1) $PageList.="<a href='view-$aid'>[1]</a> ";
else $PageList.="1 ";
}else{
$n = $i;
if($nowPage!=$i) $PageList.="<a href='view-$aid-$i.html'>[".$n."]</a> ";
else $PageList.="$n ";
}
}
if($lPage <= $totalPage) $PageList.="<a href='view-$aid-$lPage.html'>下一页</a> ";
else $PageList.= "下一页 ";
return $PageList;
}
1.2 找到:
//-------------------------
//获得动态页面小标题
//-------------------------
function GetPageTitlesDM($styleName,$pageNo)
{
if($this->TotalPage==1){ return ""; }
if(count($this->SplitTitles)==0){ return ""; }
$i=1;
$aid = $this->ArcID;
if($styleName=='link')
{
$revalue = "";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<a href='view.php?aid=$aid&pageno=$i'>$v</a> ";
else{
if($pageNo==$i) $revalue .= " $v ";
else $revalue .= "<a href='view.php?aid=$aid&pageno=$i'>$v</a> ";
}
$i++;
}
}else
{
$revalue = "<select id='dedepagetitles' onchange='location.href=this.options[this.selectedIndex].value;'>";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'& gt;{$i}、{$v}</option>";
else{
if($pageNo==$i) $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i' selected>{$i}、{$v}</option>";
else $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'& gt;{$i}、{$v}</option>";
}
$i++;
}
$revalue .= "</select>";
}
return $revalue;
}
修改为:
//获取伪静态页面小标题
function GetPageTitlesDM($styleName,$pageNo)
{
if($this->TotalPage==1){ return ""; }
if(count($this->SplitTitles)==0){ return ""; }
$i=1;
$aid = $this->ArcID;
if($styleName=='link')
{
$revalue = "";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<a href='view-$aid-$i.html'>$v</a> ";
else{
if($pageNo==$i) $revalue .= " $v ";
else $revalue .= "<a href='view-$aid-$i.html'>$v</a> ";
}
$i++;
}
}else
{
$revalue = "<select id='dedepagetitles' onchange='location.href=this.options[this.selectedIndex].value;'>";
foreach($this->SplitTitles as $k=>$v){
if($i==1) $revalue .= "<option value='".$this->Fields['phpurl']."/view-$aid-$i.html'>{$i}、{$v}& lt;/option>";
else{
if($pageNo==$i) $revalue .= "<option value='".$this->Fields['phpurl']."/view-$aid-$i.html' selected>{$i}、{$v}</option>";
else $revalue .= "<option value='".$this->Fields['phpurl']."/view-$aid-$i'>{$i}、{$v}< /option>";
}
$i++;
}
$revalue .= "</select>";
}
return $revalue;
}
2、打开 /include/inc_channel_unit_functions.php 查找
return $GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";
改成
return "/view-$aid.html";//文章页伪静态
六、完工。把栏目和文章都改为动态,刷新,dedecms全站伪静态成功。
把栏目和文章批量修改为动态的SQL语句:
update dede_arctype set isdefault=-1;
update dede_archives set ismake=-1;
更新:
DEDECMS搜索的伪静态在 .htaccess 文件里加入如下两句即可:
RewriteRule ^(.*)/search/([^/]*)$ $1/plus/search/.php/?keyword=$2
RewriteRule ^(.*)/search/([^/]*)/(/d)$ $1/plus/search/.php/?keyword=$2&PageNo=$3