About tags pseudo static configuration than other configuration is much simpler than the need to modify a few small places can be achieved.
Dedecms default tag tag URL, shaped like/tags.php?/dedecms template/, is not feel a question mark is not cool, we change
Into the/tags/dedecms template/, is not much prettier.
Now let's change it and open/include/taglib/tag.lib.php:
The code is as follows |
Copy Code |
Find: $row [' link '] = $cfg _cmsurl. " /tags.php?/". UrlEncode ($row [' keyword '])." /"; Replaced by $row [' link '] = $cfg _cmsurl. " /tags/". UrlEncode ($row [' keyword '])." /"; |
Paging should be processed if there are pagination
Modify the include/arc.taglist.class.php, locate the paging function, and replace it with:
Note: From 429 lines---->541 line is replaced with the following content!
(Hint: There are articles on the Internet in the following code in the "PageInfo" is wrong, should be "pageinfo\", or there will be error tips Oh! Code has been tested ok! )
The code is as follows |
Copy Code |
/** * Get dynamic Paging list * * @access public * @param int $list _len list Width * @param string $listitem list style * @re Turn 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\ "> Total 1 Pages/ ". $this->totalresult." Article </span> "; } if ($this->totalresult = = 0) { return "<span class=\" pageinfo\ "> Total 0 Pages/". $this->totalresult ." Article </span> "; } $maininfo = "<span class=\" pageinfo\ "> Total {$totalpage} page/". $this->totalresult. " Article </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); Get a link to the previous page and the next page if ($this->pageno!= 1) { $prepage. = "<li><a href= '". $purl. " -$prepagenum ' .html> page </a></li>rn '; $indexpage = "<li><a href= '". $purl. " -1.html ' > Home </a></li>rn '; } Else { $indexpage = "<li><a> home </a></li>rn"; } if ($this->pageno!= $totalpage && $totalpage >1) { $nextpage. = "<li><a href= '". $purl. " -$nextpagenum. html ' > next page </a></li>rn '; $endpage = "<li><a href= '". $purl. " -$totalpage. html ' > Last </a></li>rn '; } Else { $endpage = "<li><a> last </a></li>rn"; } Get Digital Links $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; } |
. htaccess or Apache configuration
code is as follows |
copy code |
Rewriterule ^ (. *)/tags\.html $1/tags\.php [I] Rewriterule ^ (. *)/tags/(. *) (. *) (?:( \?. *)) * $1/tags\.php\?\/$2 [I] Rewriterule ^ (. *)/tags/(. *) \/(. *) (?:( \?. *)) * $1/tags\.php\?\/$2\/[I] |