 {"id":182,"date":"2010-08-21T09:41:13","date_gmt":"2010-08-21T01:41:13","guid":{"rendered":"http:\/\/www.qyuef.com\/?p=182"},"modified":"2010-08-21T09:41:13","modified_gmt":"2010-08-21T01:41:13","slug":"dedecms5-5%e6%80%8e%e6%a0%b7%e7%bb%99%e6%96%87%e7%ab%a0%e9%a1%b5%e6%98%be%e7%a4%batags%e6%a0%87%e7%ad%be%e5%b9%b6%e5%8a%a0%e4%b8%8a%e9%93%be%e6%8e%a5","status":"publish","type":"post","link":"http:\/\/www.qyuef.com\/?p=182","title":{"rendered":"DEDECMS\u5728\u6587\u7ae0\u9875\u663e\u793atags\u6807\u7b7e\u5e76\u52a0\u4e0a\u94fe\u63a5\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u5728\u7ec7\u68a65.5\u4e2d\u627e\u5230\u6587\u4ef6\/include\/common.func.php\u4e2d\u7684GetTags\u51fd\u6570\uff1a<\/p>\n<pre>function GetTags($aid)\n{\n global $dsql;\n $tags = &#39;&#39;;\n $query = &quot;Select tag From <a href=\"mailto:%60#@__taglist\">`#@__taglist<\/a>` where aid=&#39;$aid&#39; &quot;;\n $dsql-&gt;Execute(&#39;tag&#39;,$query);\n while($row = $dsql-&gt;GetArray(&#39;tag&#39;))\n {\n  $tags .= ($tags==&#39;&#39; ? $row[&#39;tag&#39;] : &#39;,&#39;.$row[&#39;tag&#39;]);\n }\n return $tags;\n}<\/pre>\n<p><!--more--><\/p>\n<p>\u8be5\u51fd\u6570\uff0c\u4f7f\u7528{dede:field.tags\/}\u53ef\u8f93\u51fatags\u6807\u7b7e\u6587\u5b57\uff0c\u4f46\u6ca1\u6709\u94fe\u63a5\u3002\u5982\u679c\u4fee\u6539\u7ea2\u5b57\u90e8\u5206\uff0c\u7ed9\u8fd9\u4e9b\u6807\u7b7e\u52a0\u4e0a\u94fe\u63a5\uff0c\u6587\u7ae0\u9875\u663e\u793a\u6b63\u5e38\u4e86\uff0c\u4f46\u540e\u53f0\u7f16\u8f91\u6587\u7ae0\u65f6tags\u8868\u5355\u4e2d\u5c31\u4f1a\u51fa\u73b0\u94fe\u63a5\u5185\u5bb9\uff0c\u8bf8\u5982\uff1a&lt;a href=&#39;\/tags.php?\/\u5173\u952e\u8bcd1&#39; target=&#39;_blank&#39;&gt;\u5173\u952e\u8bcd1&lt;\/a&gt; &lt;a href=&#39;\/tags.php?\/\u5173\u952e\u8bcd2&#39; target=&#39;_blank&#39;&gt;\u5173\u952e\u8bcd2&lt;\/a&gt; &#8230; \u7b49\u7b49\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e3a\u4e86\u4e0d\u548c\u540e\u53f0\u7f16\u8f91\u8868\u5355\u51b2\u7a81\uff0c\u5176\u5b9e\u53ef\u5355\u72ec\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\uff0c\u548cGetTags\u51fd\u6570\u7c7b\u4f3c\uff0c\u53ea\u662f\u591a\u51fa\u4e86\u94fe\u63a5\u90e8\u5206\u3002\u8fd9\u91cc\uff0c\u51fd\u6570\u540d\u79f0\u5b9a\u4e3aTagslink\uff0c\u4f7f\u7528{dede:field.tagsurl\/}\u8c03\u7528\u8f93\u51fa\u3002<\/p>\n<pre>\u9996\u5148\uff0c\u5728 \/include\/common.func.php \u4e2d\u5b9a\u4e49\u5982\u4e0b\u51fd\u6570\uff08\u6ce8\u610f\u7ea2\u5b57\u90e8\u5206\u548cGetTags\u51fd\u6570\u7684\u533a\u522b\uff09\uff1a\nfunction Tagslink($aid)\n{\n global $dsql;\n $tagsurl = &#39;&#39;;\n $query = &quot;Select tag From <a href=\"mailto:%60#@__taglist\">`#@__taglist<\/a>` where aid=&#39;$aid&#39; &quot;;\n $dsql-&gt;Execute(&#39;tag&#39;,$query);\n while($row = $dsql-&gt;GetArray(&#39;tag&#39;))\n {\n  $tagsurl .= ($tagsurl==&#39;&#39; ? &quot;&lt;a href=&#39;\/tags.php?\/&quot;.urlencode($row[&#39;tag&#39;]).&quot;\/&#39; title=&#39;{$row[&#39;tag&#39;]}&#39; target=&#39;_blank&#39;&gt;{$row[&#39;tag&#39;]}&lt;\/a&gt;&quot; : &#39;  &#39;.&quot;&lt;a href=&#39;\/tags.php?\/&quot;.urlencode($row[&#39;tag&#39;]).&quot;\/&#39; title=&#39;{$row[&#39;tag&#39;]}&#39;  target=&#39;_blank&#39;&gt;{$row[&#39;tag&#39;]}&lt;\/a&gt;&quot;);\n }\n return $tagsurl;\n} <\/pre>\n<p>\u7136\u540e\uff0c\u5728 \/include\/arc.archives.class.php \u4e2d\uff0c\u627e\u5230\u8fd9\u53e5\uff1a <br \/>\n\t$this-&gt;Fields[&#39;tags&#39;] = GetTags($aid);<\/p>\n<p>\u5728\u4e0b\u9762\u52a0\u4e00\u884c\uff1a <br \/>\n\t$this-&gt;Fields[&#39;tagsurl&#39;] = Tagslink($aid);<\/p>\n<p>\u73b0\u5728\uff0c\u628a{dede:field.tagsurl\/}\u52a0\u5165\u6587\u7ae0\u9875\u76f8\u5e94\u4f4d\u7f6e\uff0c\u53ef\u4ee5\u770b\u5230\u6548\u679c\u4e86\u5427\u3002\u53e6\u5916\uff0c\u51fd\u6570\u4e2d&lt;a href=&#39;\/tags.php?\/&quot;.urlencode($row[&#39;tag&#39;]).&quot;\/&#39;\u90e8\u5206\uff0c\u5fc5\u987b\u4f7f\u7528urlencode\u8f6c\u6362\u4e00\u4e0btags\u6807\u7b7e\u6587\u5b57\uff0c\u8981\u4e0d\u7136\uff0c\u94fe\u63a5\u6587\u5b57\u4e3a\u5947\u6570\u65f6\uff0c\u5c06\u63d0\u793a\u6807\u7b7e\u4e0d\u5b58\u5728\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u7ec7\u68a65.5\u4e2d\u627e\u5230\u6587\u4ef6\/include\/common.func.php\u4e2d\u7684GetTags\u51fd\u6570\uff1a function GetTags($aid) { global $dsql; $tags = &#39;&#39;; $query = &#038;quo<a rel=\"nofollow\" class=\"more-link\" style=\"text-decoration:none;\" href=\"http:\/\/www.qyuef.com\/?p=182\">&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[18,37],"tcat":[],"_links":{"self":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/posts\/182"}],"collection":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=182"}],"version-history":[{"count":0,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/posts\/182\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=182"},{"taxonomy":"tcat","embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftcat&post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}