找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1605|回复: 0

[分享] Dedecms织梦系统Tag标签如何设置伪静态?

[复制链接]
发表于 2018-8-1 14:43:24 | 显示全部楼层 |阅读模式 来自 河南省新乡市
修改前台显示链接
我们这里达到的效果就是使原来/tags.php?keywors更改为/tags/keywords.html。
这里主要修改下调用的标签,在includetaglibtag.lib.php中,在87行找到

  1. $row['link'] = $cfg_cmsurl."/tags?".urlencode($row['keyword']);
复制代码

将其改为:

  1. $row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword']).".html";
复制代码


修改分页代码:
修改include/arc.taglist.class.php,将分页函数替换为:
  1. function GetPageListDM($list_len,$listitem="info,index,end,pre,next,pageno")
  2. {
  3.     $prepage="";
  4.     $nextpage="";
  5.     $prepagenum = $this->PageNo - 1;
  6.     $nextpagenum = $this->PageNo + 1;
  7.     if($list_len == "" || preg_match("/[^0-9]/", $list_len))
  8.     {
  9.         $list_len = 3;
  10.     }
  11.     $totalpage = $this->TotalPage;
  12. &#160;&#160;&#160;&#160;if($totalpage <= 1 && $this->TotalResult > 0)
  13. &#160;&#160;&#160;&#160;{
  14. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;"<span class="pageinfo">共1页/".$this->TotalResult."条</span>";
  15. &#160;&#160;&#160;&#160;}
  16. &#160;&#160;&#160;&#160;if($this->TotalResult == 0)
  17. &#160;&#160;&#160;&#160;{
  18. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;"<span class="pageinfo">共0页/".$this->TotalResult."条</span>";
  19. &#160;&#160;&#160;&#160;}
  20. &#160;&#160;&#160;&#160;$maininfo =&#160;"<span class="pageinfo">共{$totalpage}页/".$this->TotalResult."条</span>rn";
  21. &#160;&#160;&#160;&#160;$purl = $this->GetCurUrl();
  22. &#160;&#160;&#160;&#160;$basename&#160;=&#160;basename($purl);
  23. &#160;&#160;&#160;&#160;$tmpname = explode('.', $basename);
  24. &#160;&#160;&#160;&#160;&#160;
  25. &#160;&#160;&#160;&#160;$purl = str_replace($basename,&#160;'', $purl).urlencode($this->Tag);
  26. &#160;&#160;&#160;&#160;//var_dump($purl);exit;
  27. &#160;&#160;&#160;&#160;//$purl .=&#160;"?/".urlencode($this->Tag);

  28. &#160;&#160;&#160;&#160;//获得上一页和下一页的链接
  29. &#160;&#160;&#160;&#160;if($this->PageNo != 1)
  30. &#160;&#160;&#160;&#160;{
  31. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$prepage.="<li><a href='".$purl."-$prepagenum'.html>上一页</a></li>rn";
  32. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$indexpage="<li><a href='".$purl."-1.html'>首页</a></li>rn";
  33. &#160;&#160;&#160;&#160;}
  34. &#160;&#160;&#160;&#160;else
  35. &#160;&#160;&#160;&#160;{
  36. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$indexpage="<li><a>首页</a></li>rn";
  37. &#160;&#160;&#160;&#160;}
  38. &#160;&#160;&#160;&#160;if($this->PageNo!=$totalpage && $totalpage>1)
  39. &#160;&#160;&#160;&#160;{
  40. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$nextpage.="<li><a href='".$purl."-$nextpagenum.html'>下一页</a></li>rn";
  41. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$endpage="<li><a href='".$purl."-$totalpage.html'>末页</a></li>rn";
  42. &#160;&#160;&#160;&#160;}
  43. &#160;&#160;&#160;&#160;else
  44. &#160;&#160;&#160;&#160;{
  45. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$endpage="<li><a>末页</a></li>rn";
  46. &#160;&#160;&#160;&#160;}

  47. &#160;&#160;&#160;&#160;//获得数字链接
  48. &#160;&#160;&#160;&#160;$listdd="";
  49. &#160;&#160;&#160;&#160;$total_list = $list_len * 2 + 1;
  50. &#160;&#160;&#160;&#160;if($this->PageNo >= $total_list)
  51. &#160;&#160;&#160;&#160;{
  52. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$j = $this->PageNo - $list_len;
  53. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$total_list = $this->PageNo + $list_len;
  54. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if($total_list > $totalpage)
  55. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{
  56. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$total_list = $totalpage;
  57. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
  58. &#160;&#160;&#160;&#160;}
  59. &#160;&#160;&#160;&#160;else
  60. &#160;&#160;&#160;&#160;{
  61. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$j=1;
  62. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if($total_list > $totalpage)
  63. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{
  64. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$total_list = $totalpage;
  65. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
  66. &#160;&#160;&#160;&#160;}
  67. &#160;&#160;&#160;&#160;for($j; $j<=$total_list; $j++)
  68. &#160;&#160;&#160;&#160;{
  69. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if($j == $this->PageNo)
  70. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{
  71. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$listdd.=&#160;"<li class="thisclass"><a>$j</a></li>rn";
  72. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
  73. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else
  74. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{
  75. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$listdd.="<li><a href='".$purl."-$j.html'>".$j."</a></li>rn";
  76. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
  77. &#160;&#160;&#160;&#160;}
  78. &#160;&#160;&#160;&#160;$plist&#160; =&#160;&#160;'';
  79. &#160;&#160;&#160;&#160;if(preg_match('/info/i', $listitem))
  80. &#160;&#160;&#160;&#160;{
  81. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$plist .= $maininfo.' ';
  82. &#160;&#160;&#160;&#160;}
  83. &#160;&#160;&#160;&#160;if(preg_match('/index/i', $listitem))
  84. &#160;&#160;&#160;&#160;{
  85. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$plist .= $indexpage.' ';
  86. &#160;&#160;&#160;&#160;}
  87. &#160;&#160;&#160;&#160;if(preg_match('/pre/i', $listitem))
  88. &#160;&#160;&#160;&#160;{
  89. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$plist .= $prepage.' ';
  90. &#160;&#160;&#160;&#160;}
  91. &#160;&#160;&#160;&#160;if(preg_match('/pageno/i', $listitem))
  92. &#160;&#160;&#160;&#160;{
  93. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$plist .= $listdd.' ';
  94. &#160;&#160;&#160;&#160;}
  95. &#160;&#160;&#160;&#160;if(preg_match('/next/i', $listitem))
  96. &#160;&#160;&#160;&#160;{
  97. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$plist .= $nextpage.' ';
  98. &#160;&#160;&#160;&#160;}
  99. &#160;&#160;&#160;&#160;if(preg_match('/end/i', $listitem))
  100. &#160;&#160;&#160;&#160;{
  101. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$plist .= $endpage.' ';
  102. &#160;&#160;&#160;&#160;}
  103. &#160;&#160;&#160;&#160;return&#160;$plist;
  104. }
复制代码


设置伪静态规则
  1. <?xml version="1.0"&#160;encoding="UTF-8"?>
  2. <configuration>
  3. &#160;&#160;&#160;&#160;<system.webServer>
  4. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<rewrite>
  5. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<rules>
  6. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<rule name="weather1"&#160;stopProcessing="true">
  7. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<match url="tags/([^-]+).html$"&#160;ignoreCase="true"&#160;/>
  8. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<conditions logicalGrou[url=http://bbs.piaoxian.net/thread-76922-1-1.html]ping[/url]="MatchAll">
  9. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<add input="{REQUEST_FILENAME}"&#160;matchType="IsFile"negate="true"&#160;/>
  10. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<add input="{REQUEST_FILENAME}"matchType="IsDirectory"&#160;negate="true"&#160;/>
  11. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</conditions>
  12. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<action&#160;type="Rewrite"&#160;url="/tags.php?/{R:1}"appendQueryString="false"&#160;/>
  13. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</rule>
  14. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<rule name="weather2"&#160;stopProcessing="true">
  15. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<match url="tags/([^-]+)-([0-9]+).html$"ignoreCase="true"&#160;/>
  16. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<conditions logicalGrouping="MatchAll">
  17. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<add input="{REQUEST_FILENAME}"&#160;matchType="IsFile"negate="true"&#160;/>
  18. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<add input="{REQUEST_FILENAME}"matchType="IsDirectory"&#160;negate="true"&#160;/>
  19. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</conditions>
  20. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<action&#160;type="Rewrite"&#160;url="/tags.php?/{R:1}/{R:2}"appendQueryString="false"&#160;/>
  21. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</rule>
  22. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</rules>
  23. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</rewrite>
  24. &#160;&#160;&#160;&#160;</system.webServer>
  25. </configuration>
复制代码


可以直接保存为web.config放在站点根目录。

重新生成html页面。

至此,我们已经完成了所有的设置,预览查看显示结果。

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则 需要先绑定手机号

关闭

站长推荐上一条 /1 下一条

QQ|侵权投诉|广告报价|手机版|小黑屋|西部数码代理|飘仙建站论坛 ( 豫ICP备2022021143号-1 )

GMT+8, 2024-5-22 11:56 , Processed in 0.049467 second(s), 8 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表