{"id":30327,"date":"2024-11-25T10:10:39","date_gmt":"2024-11-25T02:10:39","guid":{"rendered":"https:\/\/fwq.ai\/blog\/30327\/"},"modified":"2024-11-25T10:10:39","modified_gmt":"2024-11-25T02:10:39","slug":"dedecms%e7%b3%bb%e7%bb%9ftag%e6%a0%87%e7%ad%be%e5%92%8c%e5%88%86%e9%a1%b5%e4%bc%aa%e9%9d%99%e6%80%81%e6%80%8e%e4%b9%88%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/30327\/","title":{"rendered":"DedeCMS\u7cfb\u7edfTAG\u6807\u7b7e\u548c\u5206\u9875\u4f2a\u9759\u6001\u600e\u4e48\u8bbe\u7f6e"},"content":{"rendered":"<p style=\"text-align: center\"><strong><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/020\/5df442c24f15e848.jpg\" class=\"aligncenter\" title=\"DedeCMS\u7cfb\u7edfTAG\u6807\u7b7e\u548c\u5206\u9875\u4f2a\u9759\u6001\u600e\u4e48\u8bbe\u7f6e\u63d2\u56fe\" alt=\"DedeCMS\u7cfb\u7edfTAG\u6807\u7b7e\u548c\u5206\u9875\u4f2a\u9759\u6001\u600e\u4e48\u8bbe\u7f6e\u63d2\u56fe\" \/><\/strong><\/p>\n<p><strong>\u7cfb\u7edftag\u6807\u7b7e\u548c\u5206\u9875\u4f2a\u9759\u6001\u600e\u4e48\u8bbe\u7f6e?<\/strong><\/p>\n<p>\u73b0\u5728\u597d\u591aCMS\u7cfb\u7edf\u90fd\u6709TAGS\u6807\u7b7e\u8fd9\u9879\u529f\u80fd\uff0c\u77e5\u540d\u7684DEDECMS\u4e5f\u6709\uff0c\u4f46\u662f\u5b83\u7684\u6807\u7b7e\u529f\u80fd\u5f88\u5dee\uff0c\u4e0d\u5229\u4e8eseo\u4f18\u5316\uff0c\u540c\u65f6\u4e5f\u6709\u5f88\u591a\u95ee\u9898\uff0c\u6bd4\u5982\uff1a\u5f53\u524d\u9875\u4e0d\u5b58\u5728\u4e0a\u4e00\u9875\u65f6\uff0c\u94fe\u63a5\u4e3a\u201c-1\u201d\u7684\u95ee\u9898\uff0c\u8fd8\u6709\u51fa\u73b0\u201c\u7cfb\u7edf\u65e0\u6b64\u6807\u7b7e\uff0c\u53ef\u80fd\u5df2\u7ecf\u79fb\u9664\u201d\u7684\u95ee\u9898\u3002<\/p>\n<p>\u63a8\u8350\u5b66\u4e60\uff1a<\/p>\n<p>\u4eca\u5929\u5c0f\u7f16\u5c31\u6559\u5927\u5bb6\u628a\u6807\u7b7e\u4f2a\u9759\u6001\uff08\u90e8\u5206\u8d44\u6599\u6765\u6e90\u4e8e\u7f51\u7edc\uff09\uff0c\u540c\u65f6\u4e5f\u4fee\u590d\u4e86\u4e00\u4e9b\u4e0a\u8ff0\u63d0\u5230\u7684BUG\u3002<\/p>\n<p>1.\u4fee\u6539\u524d\u53f0\u663e\u793a\u94fe\u63a5<\/p>\n<p>\u6211\u4eec\u8fd9\u91cc\u8fbe\u5230\u7684\u6548\u679c\u5c31\u662f\u4f7f\u539f\u6765\/tags.php?keywors\u66f4\u6539\u4e3a\/tags\/keywords.html\u3002<\/p>\n<p>\u8fd9\u91cc\u4e3b\u8981\u4fee\u6539\u4e0b\u8c03\u7528\u7684\u6807\u7b7e\uff0c\u5728\/include\/taglib\/tag.lib.php\u4e2d\uff0c\u572887\u884c\u627e\u5230<\/p>\n<pre>$row['link']&nbsp;=&nbsp;$cfg_cmsurl.\"\/tags?\".urlencode($row['keyword']);\u3000\u3000<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5c06\u5176\u6539\u4e3a\uff1a<\/p>\n<pre>$row['link']&nbsp;=&nbsp;$cfg_cmsurl.\"\/tags\/\".urlencode($row['keyword']).\".html\";<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>2.\u4fee\u6539\u5206\u9875\u4ee3\u7801\u90e8\u5206<\/p>\n<p>\u6211\u4eec\u9700\u8981\u4fee\u6539include\/arc.taglist.class.php\uff0c\u627e\u5230\u5206\u9875\u51fd\u6570\uff0c\u5c06\u5176\u66ff\u6362\u4e3a\uff1a<\/p>\n<pre>\/**&nbsp;\n*&nbsp;\u83b7\u53d6\u52a8\u6001\u7684\u5206\u9875\u5217\u8868&nbsp;\n*&nbsp;\n*&nbsp;@access&nbsp;public&nbsp;\n*&nbsp;@param&nbsp;int&nbsp;$list_len&nbsp;\u5217\u8868\u5bbd\u5ea6&nbsp;\n*&nbsp;@param&nbsp;string&nbsp;$listitem&nbsp;\u5217\u8868\u6837\u5f0f&nbsp;\n*&nbsp;@return&nbsp;string&nbsp;\n*\/\nfunction&nbsp;GetPageListDM($list_len,$listitem=\"info,index,end,pre,next,pageno\")&nbsp;\n{&nbsp;\n$prepage=\"\";&nbsp;\n$nextpage=\"\";&nbsp;\n$prepagenum&nbsp;=&nbsp;$this-&amp;gt;PageNo&nbsp;-&nbsp;1;&nbsp;\n$nextpagenum&nbsp;=&nbsp;$this-&amp;gt;PageNo&nbsp;+&nbsp;1;&nbsp;\nif($list_len&nbsp;==&nbsp;\"\"&nbsp;||&nbsp;preg_match(\"\/[^0-9]\/\",&nbsp;$list_len))&nbsp;\n{&nbsp;\n$list_len&nbsp;=&nbsp;3;&nbsp;\n}&nbsp;\n$totalpage&nbsp;=&nbsp;$this-&amp;gt;TotalPage;&nbsp;\nif($totalpage&nbsp;TotalResult&nbsp;&amp;gt;&nbsp;0)&nbsp;\n{&nbsp;\nreturn&nbsp;\"&lt;span&gt;\u51711\u9875\/\".$this-&amp;gt;TotalResult.\"\u6761&lt;\/span&gt;\";&nbsp;\n}&nbsp;\nif($this-&amp;gt;TotalResult&nbsp;==&nbsp;0)&nbsp;\n{&nbsp;\nreturn&nbsp;\"&lt;span&gt;\u51710\u9875\/\".$this-&amp;gt;TotalResult.\"\u6761&lt;\/span&gt;\";&nbsp;\n}&nbsp;\n$maininfo&nbsp;=&nbsp;\"&lt;span&gt;\u5171{$totalpage}\u9875\/\".$this-&amp;gt;TotalResult.\"\u6761&lt;\/span&gt;\r\n\";&nbsp;\n$purl&nbsp;=&nbsp;$this-&amp;gt;GetCurUrl();&nbsp;\n$basename&nbsp;=&nbsp;basename($purl);&nbsp;\n$tmpname&nbsp;=&nbsp;explode('.',&nbsp;$basename);&nbsp;\n&nbsp;\n$purl&nbsp;=&nbsp;str_replace($basename,&nbsp;'',&nbsp;$purl).urlencode($this-&amp;gt;Tag);&nbsp;\n\/\/var_dump($purl);exit;&nbsp;\n\/\/$purl&nbsp;.=&nbsp;\"?\/\".urlencode($this-&amp;gt;Tag);&nbsp;\n&nbsp;\n\/\/\u83b7\u5f97\u4e0a\u4e00\u9875\u548c\u4e0b\u4e00\u9875\u7684\u94fe\u63a5&nbsp;\n\/\/if($this-&amp;gt;PageNo&nbsp;!=&nbsp;1)&nbsp;\u8fd9\u662f\u4fee\u6b63\u4e0a\u4e00\u9875\u4e3a\u8d1f\u6570\u7684\u95ee\u9898\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($this-&amp;gt;PageNo&nbsp;!=&nbsp;1&nbsp;&amp;amp;&amp;amp;&nbsp;$this-&amp;gt;PageNo&nbsp;!=&nbsp;\"\")\n{&nbsp;\n$prepage.=\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<li><\/li>\n<p> &#8220;;&nbsp; $indexpage=&#8221; <\/p>\n<li><\/li>\n<p> &#8220;;&nbsp; }&nbsp; else {&nbsp; $indexpage=&#8221; <\/p>\n<li><\/li>\n<p> &#8220;;&nbsp; }&nbsp; if($this-&gt;PageNo!=$totalpage&nbsp;&amp;&amp;&nbsp;$totalpage&gt;1)&nbsp; {&nbsp; $nextpage.=&#8221; <\/p>\n<li><\/li>\n<p> &#8220;;&nbsp; $endpage=&#8221; <\/p>\n<li><\/li>\n<p> &#8220;;&nbsp; }&nbsp; else {&nbsp; $endpage=&#8221; <\/p>\n<li><\/li>\n<p> &#8220;;&nbsp; }&nbsp; &nbsp; \/\/\u83b7\u5f97\u6570\u5b57\u94fe\u63a5&nbsp; $listdd=&#8221;&#8221;;&nbsp; $total_list&nbsp;=&nbsp;$list_len&nbsp;*&nbsp;2&nbsp;+&nbsp;1;&nbsp; if($this-&gt;PageNo&nbsp;&gt;=&nbsp;$total_list)&nbsp; {&nbsp; $j&nbsp;=&nbsp;$this-&gt;PageNo&nbsp;&#8211;&nbsp;$list_len;&nbsp; $total_list&nbsp;=&nbsp;$this-&gt;PageNo&nbsp;+&nbsp;$list_len;&nbsp; if($total_list&nbsp;&gt;&nbsp;$totalpage)&nbsp; {&nbsp; $total_list&nbsp;=&nbsp;$totalpage;&nbsp; }&nbsp; }&nbsp; else {&nbsp; $j=1;&nbsp; if($total_list&nbsp;&gt;&nbsp;$totalpage)&nbsp; {&nbsp; $total_list&nbsp;=&nbsp;$totalpage;&nbsp; }&nbsp; }&nbsp; for($j;&nbsp;$jPageNo)&nbsp; {&nbsp; $listdd.=&nbsp;&#8221; <\/p>\n<li><\/li>\n<p> &#8220;;&nbsp; }&nbsp; else {&nbsp; $listdd.=&#8221; <\/p>\n<li><\/li>\n<p> &#8220;;&nbsp; }&nbsp; }&nbsp; $plist&nbsp;=&nbsp;&#8221;;&nbsp; if(preg_match(&#8216;\/info\/i&#8217;,&nbsp;$listitem))&nbsp; {&nbsp; $plist&nbsp;.=&nbsp;$maininfo.&#8217;&nbsp;&#8216;;&nbsp; }&nbsp; if(preg_match(&#8216;\/index\/i&#8217;,&nbsp;$listitem))&nbsp; {&nbsp; $plist&nbsp;.=&nbsp;$indexpage.&#8217;&nbsp;&#8216;;&nbsp; }&nbsp; if(preg_match(&#8216;\/pre\/i&#8217;,&nbsp;$listitem))&nbsp; {&nbsp; $plist&nbsp;.=&nbsp;$prepage.&#8217;&nbsp;&#8216;;&nbsp; }&nbsp; if(preg_match(&#8216;\/pageno\/i&#8217;,&nbsp;$listitem))&nbsp; {&nbsp; $plist&nbsp;.=&nbsp;$listdd.&#8217;&nbsp;&#8216;;&nbsp; }&nbsp; if(preg_match(&#8216;\/next\/i&#8217;,&nbsp;$listitem))&nbsp; {&nbsp; $plist&nbsp;.=&nbsp;$nextpage.&#8217;&nbsp;&#8216;;&nbsp; }&nbsp; if(preg_match(&#8216;\/end\/i&#8217;,&nbsp;$listitem))&nbsp; {&nbsp; $plist&nbsp;.=&nbsp;$endpage.&#8217;&nbsp;&#8216;;&nbsp; }&nbsp; return&nbsp;$plist;&nbsp; } <\/p>\n<p>3.\u8bbe\u7f6e\u4f2a\u9759\u6001\u89c4\u5219<\/p>\n<p>\u6211\u4eec\u8fd9\u91cc\u4ee5iis7\u4e3a\u4f8b\u5b50\uff0c\u8bbe\u7f6e\u4ee5\u4e0b\u89c4\u5219\uff1a<\/p>\n<pre>&lt;?xml  version=\"1.0\" encoding=\"UTF-8\"?&gt;&nbsp;\n&lt;configuration&gt;&nbsp;\n&lt;system.webserver&gt;&nbsp;\n&lt;rewrite&gt;&nbsp;\n&lt;rules&gt;&nbsp;\n&lt;rule&gt;&nbsp;\n&lt;match&gt;&lt;\/match&gt;&nbsp;\n&lt;conditions&gt;&nbsp;\n&lt;add&gt;&lt;\/add&gt;&nbsp;\n&lt;add&gt;&lt;\/add&gt;&nbsp;\n&lt;\/conditions&gt;&nbsp;\n&lt;action&gt;&lt;\/action&gt;&nbsp;\n&lt;\/rule&gt;&nbsp;\n&lt;rule&gt;&nbsp;\n&lt;match&gt;&lt;\/match&gt;&nbsp;\n&lt;conditions&gt;&nbsp;\n&lt;add&gt;&lt;\/add&gt;&nbsp;\n&lt;add&gt;&lt;\/add&gt;&nbsp;\n&lt;\/conditions&gt;&nbsp;\n&lt;action&gt;&lt;\/action&gt;&nbsp;\n&lt;\/rule&gt;&nbsp;\n&lt;\/rules&gt;&nbsp;\n&lt;\/rewrite&gt;&nbsp;\n&lt;\/system.webserver&gt;&nbsp;\n&lt;\/configuration&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fDedeCMS\u7cfb\u7edfTAG\u6807\u7b7e\u548c\u5206\u9875\u4f2a\u9759\u6001\u600e\u4e48\u8bbe\u7f6e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7cfb\u7edftag\u6807\u7b7e\u548c\u5206\u9875\u4f2a\u9759\u6001\u600e\u4e48\u8bbe\u7f6e? \u73b0\u5728\u597d\u591aCMS\u7cfb\u7edf\u90fd\u6709TAGS\u6807\u7b7e\u8fd9\u9879\u529f\u80fd\uff0c\u77e5\u540d\u7684DEDECMS\u4e5f\u6709\uff0c\u4f46\u662f\u5b83\u7684\u6807\u7b7e\u529f\u80fd\u5f88\u5dee\uff0c\u4e0d\u5229\u4e8eseo\u4f18\u5316\uff0c\u540c\u65f6\u4e5f\u6709\u5f88\u591a\u95ee\u9898\uff0c\u6bd4\u5982\uff1a\u5f53\u524d\u9875\u4e0d\u5b58\u5728\u4e0a\u4e00\u9875\u65f6\uff0c\u94fe\u63a5\u4e3a\u201c-1\u201d\u7684\u95ee\u9898\uff0c\u8fd8\u6709\u51fa\u73b0\u201c\u7cfb\u7edf\u65e0\u6b64\u6807\u7b7e\uff0c\u53ef\u80fd\u5df2\u7ecf\u79fb\u9664\u201d\u7684\u95ee\u9898\u3002 \u63a8\u8350\u5b66\u4e60\uff1a \u4eca\u5929\u5c0f\u7f16\u5c31\u6559\u5927\u5bb6\u628a\u6807\u7b7e\u4f2a\u9759\u6001\uff08\u90e8\u5206\u8d44\u6599\u6765\u6e90\u4e8e\u7f51\u7edc\uff09\uff0c\u540c\u65f6\u4e5f\u4fee\u590d\u4e86\u4e00\u4e9b\u4e0a\u8ff0\u63d0\u5230\u7684BUG\u3002 1.\u4fee\u6539\u524d\u53f0\u663e\u793a\u94fe\u63a5 \u6211\u4eec\u8fd9\u91cc\u8fbe\u5230\u7684\u6548\u679c\u5c31\u662f\u4f7f\u539f\u6765\/tags.php?keywors\u66f4\u6539\u4e3a\/tags\/keywords.html\u3002 \u8fd9\u91cc\u4e3b\u8981\u4fee\u6539\u4e0b\u8c03\u7528\u7684\u6807\u7b7e\uff0c\u5728\/include\/taglib\/tag.lib.php\u4e2d\uff0c\u572887\u884c\u627e\u5230 $row[&#8216;link&#8217;]&nbsp;=&nbsp;$cfg_cmsurl.&#8221;\/tags?&#8221;.urlencode($row[&#8216;keyword&#8217;]);\u3000\u3000 \u767b\u5f55\u540e\u590d\u5236 \u5c06\u5176\u6539\u4e3a\uff1a $row[&#8216;link&#8217;]&nbsp;=&nbsp;$cfg_cmsurl.&#8221;\/tags\/&#8221;.urlencode($row[&#8216;keyword&#8217;]).&#8221;.html&#8221;; \u767b\u5f55\u540e\u590d\u5236 2.\u4fee\u6539\u5206\u9875\u4ee3\u7801\u90e8\u5206 \u6211\u4eec\u9700\u8981\u4fee\u6539include\/arc.taglist.class.php\uff0c\u627e\u5230\u5206\u9875\u51fd\u6570\uff0c\u5c06\u5176\u66ff\u6362\u4e3a\uff1a \/**&nbsp; *&nbsp;\u83b7\u53d6\u52a8\u6001\u7684\u5206\u9875\u5217\u8868&nbsp; *&nbsp; *&nbsp;@access&nbsp;public&nbsp; *&nbsp;@param&nbsp;int&nbsp;$list_len&nbsp;\u5217\u8868\u5bbd\u5ea6&nbsp; *&nbsp;@param&nbsp;string&nbsp;$listitem&nbsp;\u5217\u8868\u6837\u5f0f&nbsp; *&nbsp;@return&nbsp;string&nbsp; *\/ function&nbsp;GetPageListDM($list_len,$listitem=&#8221;info,index,end,pre,next,pageno&#8221;)&nbsp; {&nbsp; $prepage=&#8221;&#8221;;&nbsp; $nextpage=&#8221;&#8221;;&nbsp; $prepagenum&nbsp;=&nbsp;$this-&amp;gt;PageNo&nbsp;&#8211;&nbsp;1;&nbsp; $nextpagenum&nbsp;=&nbsp;$this-&amp;gt;PageNo&nbsp;+&nbsp;1;&nbsp; if($list_len&nbsp;==&nbsp;&#8220;&#8221;&nbsp;||&nbsp;preg_match(&#8220;\/[^0-9]\/&#8221;,&nbsp;$list_len))&nbsp; {&nbsp; $list_len&nbsp;=&nbsp;3;&nbsp; }&nbsp; $totalpage&nbsp;=&nbsp;$this-&amp;gt;TotalPage;&nbsp; if($totalpage&nbsp;TotalResult&nbsp;&amp;gt;&nbsp;0)&nbsp; {&nbsp; return&nbsp;&#8220;&lt;span&gt;\u51711\u9875\/&#8221;.$this-&amp;gt;TotalResult.&#8221;\u6761&lt;\/span&gt;&#8221;;&nbsp; }&nbsp; if($this-&amp;gt;TotalResult&nbsp;==&nbsp;0)&nbsp; {&nbsp; return&nbsp;&#8220;&lt;span&gt;\u51710\u9875\/&#8221;.$this-&amp;gt;TotalResult.&#8221;\u6761&lt;\/span&gt;&#8221;;&nbsp; }&nbsp; $maininfo&nbsp;=&nbsp;&#8220;&lt;span&gt;\u5171{$totalpage}\u9875\/&#8221;.$this-&amp;gt;TotalResult.&#8221;\u6761&lt;\/span&gt; &#8220;;&nbsp; $purl&nbsp;=&nbsp;$this-&amp;gt;GetCurUrl();&nbsp; $basename&nbsp;=&nbsp;basename($purl);&nbsp; $tmpname&nbsp;=&nbsp;explode(&#8216;.&#8217;,&nbsp;$basename);&nbsp; &nbsp; $purl&nbsp;=&nbsp;str_replace($basename,&nbsp;&#8221;,&nbsp;$purl).urlencode($this-&amp;gt;Tag);&nbsp; \/\/var_dump($purl);exit;&nbsp; \/\/$purl&nbsp;.=&nbsp;&#8220;?\/&#8221;.urlencode($this-&amp;gt;Tag);&nbsp; &nbsp; \/\/\u83b7\u5f97\u4e0a\u4e00\u9875\u548c\u4e0b\u4e00\u9875\u7684\u94fe\u63a5&nbsp; \/\/if($this-&amp;gt;PageNo&nbsp;!=&nbsp;1)&nbsp;\u8fd9\u662f\u4fee\u6b63\u4e0a\u4e00\u9875\u4e3a\u8d1f\u6570\u7684\u95ee\u9898 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($this-&amp;gt;PageNo&nbsp;!=&nbsp;1&nbsp;&amp;amp;&amp;amp;&nbsp;$this-&amp;gt;PageNo&nbsp;!=&nbsp;&#8220;&#8221;) {&nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-30327","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=30327"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30327\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=30327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=30327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=30327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}