Browse Source

伪静态

tags/6.5.2
叙述、别离 1 week ago
parent
commit
57423732e5
3 changed files with 24 additions and 9 deletions
  1. +8
    -8
      src/system/archive/archives.class.php
  2. +13
    -0
      src/system/archive/taglist.class.php
  3. +3
    -1
      src/system/taglib/tag.lib.php

+ 8
- 8
src/system/archive/archives.class.php View File

@@ -861,7 +861,7 @@ class Archives
if ($cfg_rewrite == 'Y') { if ($cfg_rewrite == 'Y') {
$revalue .= "<a href='/article/$aid-$i.html'>$v</a>"; $revalue .= "<a href='/article/$aid-$i.html'>$v</a>";
} else { } else {
$revalue .= "<a href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>$v</a>";
$revalue .= "<a href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>$v</a>";
} }
} else { } else {
if ($pageNo == $i) { if ($pageNo == $i) {
@@ -870,7 +870,7 @@ class Archives
if ($cfg_rewrite == 'Y') { if ($cfg_rewrite == 'Y') {
$revalue .= "<a href='/article/$aid-$i.html'>$v</a>"; $revalue .= "<a href='/article/$aid-$i.html'>$v</a>";
} else { } else {
$revalue .= "<a href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>$v</a>";
$revalue .= "<a href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>$v</a>";
} }
} }
@@ -884,20 +884,20 @@ class Archives
if ($cfg_rewrite == 'Y') { if ($cfg_rewrite == 'Y') {
$revalue .= "<option value='/article/$aid-$i.html'>{$i}、{$v}</option>"; $revalue .= "<option value='/article/$aid-$i.html'>{$i}、{$v}</option>";
} else { } else {
$revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>";
$revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>{$i}、{$v}</option>";
} }
} else { } else {
if ($pageNo == $i) { if ($pageNo == $i) {
if ($cfg_rewrite == 'Y') { if ($cfg_rewrite == 'Y') {
$revalue .= "<option value='/article/$aid-$i.html' selected>{$i}、{$v}</option>"; $revalue .= "<option value='/article/$aid-$i.html' selected>{$i}、{$v}</option>";
} else { } else {
$revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i' selected>{$i}、{$v}</option>";
$revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i' selected>{$i}、{$v}</option>";
} }
} else { } else {
if ($cfg_rewrite == 'Y') { if ($cfg_rewrite == 'Y') {
$revalue .= "<option value='/article/$aid-$i.html'>{$i}、{$v}</option>"; $revalue .= "<option value='/article/$aid-$i.html'>{$i}、{$v}</option>";
} else { } else {
$revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>";
$revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>{$i}、{$v}</option>";
} }
} }
} }
@@ -938,7 +938,7 @@ class Archives
if ($cfg_rewrite == 'Y') { if ($cfg_rewrite == 'Y') {
$PageList .= "<li class='page-item'><a class='page-link' href='".$cfg_cmsurl."/article/$aid-$nPage.html'>上页</a></li>"; $PageList .= "<li class='page-item'><a class='page-link' href='".$cfg_cmsurl."/article/$aid-$nPage.html'>上页</a></li>";
} else { } else {
$PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$nPage'>上页</a></li>";
$PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$nPage'>上页</a></li>";
} }
} }
} }
@@ -959,7 +959,7 @@ class Archives
if ($cfg_rewrite == 'Y') { if ($cfg_rewrite == 'Y') {
$PageList .= "<li class='page-item'><a class='page-link' href='".$cfg_cmsurl."/article/$aid-$i.html'>{$n}</a></li>"; $PageList .= "<li class='page-item'><a class='page-link' href='".$cfg_cmsurl."/article/$aid-$i.html'>{$n}</a></li>";
} else { } else {
$PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$n}</a></li>";
$PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$i'>{$n}</a></li>";
} }
} else { } else {
$PageList .= "<li class='page-item active'><span class='page-link'>{$n}</span></li>"; $PageList .= "<li class='page-item active'><span class='page-link'>{$n}</span></li>";
@@ -970,7 +970,7 @@ class Archives
if ($cfg_rewrite == 'Y') { if ($cfg_rewrite == 'Y') {
$PageList .= "<li class='page-item'><a class='page-link' href='".$cfg_cmsurl."/article/$aid-$lPage.html'>下页</a></li>"; $PageList .= "<li class='page-item'><a class='page-link' href='".$cfg_cmsurl."/article/$aid-$lPage.html'>下页</a></li>";
} else { } else {
$PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$lPage'>下页</a></li>";
$PageList .= "<li class='page-item'><a class='page-link' href='".$this->Fields['phpurl']."/view.php?aid=$aid&PageNo=$lPage'>下页</a></li>";
} }
} else { } else {
$PageList .= "<li class='page-item'><span class='page-link'>下页</span></li>"; $PageList .= "<li class='page-item'><span class='page-link'>下页</span></li>";


+ 13
- 0
src/system/archive/taglist.class.php View File

@@ -529,6 +529,7 @@ class TagList
*/ */
function GetPageListDM($list_len, $listitem = "info,index,end,pre,next,pageno") function GetPageListDM($list_len, $listitem = "info,index,end,pre,next,pageno")
{ {
global $cfg_rewrite;
$prepage = ''; $prepage = '';
$nextpage = ''; $nextpage = '';
$prepagenum = $this->PageNo - 1; $prepagenum = $this->PageNo - 1;
@@ -545,6 +546,13 @@ class TagList
} }
$maininfo = "<li class='page-item disabled'><span class='page-link'>{$totalpage}页".$this->TotalResult."条</span></li>"; $maininfo = "<li class='page-item disabled'><span class='page-link'>{$totalpage}页".$this->TotalResult."条</span></li>";
$purl = $this->GetCurUrl(); $purl = $this->GetCurUrl();
//开启伪静态对规则替换
if ($cfg_rewrite == 'Y') {
$purl = str_replace("/apps", "", $purl);
$nowurls = preg_replace("/", ".php?", $purl);
$nowurls = explode("?", $nowurls);
$purl = $nowurls[0];
}
$purl .= "?/".urlencode($this->Tag); $purl .= "?/".urlencode($this->Tag);
//获得上页和下页的链接 //获得上页和下页的链接
if ($this->PageNo != 1) { if ($this->PageNo != 1) {
@@ -588,6 +596,11 @@ class TagList
if (preg_match('/next/i', $listitem)) $plist .= $nextpage; if (preg_match('/next/i', $listitem)) $plist .= $nextpage;
if (preg_match('/end/i', $listitem)) $plist .= $endpage; if (preg_match('/end/i', $listitem)) $plist .= $endpage;
if (preg_match('/info/i', $listitem)) $plist .= $maininfo; if (preg_match('/info/i', $listitem)) $plist .= $maininfo;
//伪静态标签分页
if ($cfg_rewrite == 'Y') {
$plist = str_replace("?/", "", $plist);
$plist = preg_replace("/&pageno=(\d+)/i", "/\\1", $plist);
}
return $plist; return $plist;
} }
/** /**


+ 3
- 1
src/system/taglib/tag.lib.php View File

@@ -11,7 +11,7 @@ if (!defined('DEDEINC')) exit ('dedebiz');
*/ */
function lib_tag(&$ctag, &$refObj) function lib_tag(&$ctag, &$refObj)
{ {
global $dsql, $envs, $cfg_cmsurl, $cfg_tags_dir;
global $dsql, $envs, $cfg_cmsurl, $cfg_tags_dir ,$cfg_rewrite;
$attlist = "row|30,sort|new,getall|0,typeid|0,ishtml|0"; $attlist = "row|30,sort|new,getall|0,typeid|0,ishtml|0";
FillAttsDefault($ctag->CAttribute->Items, $attlist); FillAttsDefault($ctag->CAttribute->Items, $attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP); extract($ctag->CAttribute->Items, EXTR_SKIP);
@@ -54,6 +54,8 @@ function lib_tag(&$ctag, &$refObj)
$row['tag'] = dede_htmlspecialchars($row['tag']); $row['tag'] = dede_htmlspecialchars($row['tag']);
if (isset($envs['makeTag']) && $envs['makeTag'] == 1 || $ishtml == 1) { if (isset($envs['makeTag']) && $envs['makeTag'] == 1 || $ishtml == 1) {
$row['link'] = $cfg_cmsurl.$tagsdir."/".$row['id']."/"; $row['link'] = $cfg_cmsurl.$tagsdir."/".$row['id']."/";
} else if ($cfg_rewrite == 'Y') {
$row['link'] = $cfg_cmsurl."/tags/".$row['id'];
} else { } else {
$row['link'] = $cfg_cmsurl."/apps/tags.php?/".$row['id']; $row['link'] = $cfg_cmsurl."/apps/tags.php?/".$row['id'];
} }


Loading…
Cancel
Save