{"id":30331,"date":"2024-11-25T11:31:42","date_gmt":"2024-11-25T03:31:42","guid":{"rendered":"https:\/\/fwq.ai\/blog\/30331\/"},"modified":"2024-11-25T11:31:42","modified_gmt":"2024-11-25T03:31:42","slug":"dedecms%e6%80%8e%e4%b9%88%e8%8e%b7%e5%8f%96%e4%bb%bb%e6%84%8f%e6%a0%8f%e7%9b%aen%e7%ba%a7%e5%88%97%e8%a1%a8%e9%93%be%e6%8e%a5%e6%a0%91%e5%bd%a2%e8%8f%9c%e5%8d%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/30331\/","title":{"rendered":"DedeCms\u600e\u4e48\u83b7\u53d6\u4efb\u610f\u680f\u76eeN\u7ea7\u5217\u8868\u94fe\u63a5\u6811\u5f62\u83dc\u5355"},"content":{"rendered":"<p style=\"text-align: center\"><strong><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/020\/5df44740bd949302.jpg\" class=\"aligncenter\" title=\"DedeCms\u600e\u4e48\u83b7\u53d6\u4efb\u610f\u680f\u76eeN\u7ea7\u5217\u8868\u94fe\u63a5\u6811\u5f62\u83dc\u5355\u63d2\u56fe\" alt=\"DedeCms\u600e\u4e48\u83b7\u53d6\u4efb\u610f\u680f\u76eeN\u7ea7\u5217\u8868\u94fe\u63a5\u6811\u5f62\u83dc\u5355\u63d2\u56fe\" \/><\/strong><\/p>\n<p><strong>\u600e\u4e48\u83b7\u53d6\u4efb\u610f\u680f\u76een\u7ea7\u5217\u8868\u94fe\u63a5\u6811\u5f62\u83dc\u5355\uff1f<\/strong><\/p>\n<p>DedeCms\u83b7\u53d6\u4efb\u610f\u680f\u76eeN\u7ea7\u5217\u8868\u94fe\u63a5\u6811\u5f62\u83dc\u5355\uff0c\u5c0f\u7f16\u63d0\u793a\uff0c\u4e0b\u8fb9\u7684\u4fee\u6539\u65b9\u6cd5\uff0c\u9002\u7528\u4e8eDedeCMS\u9ed8\u8ba4\u7684\u8868\u524d\u7f00\uff0c\u5982\u679c\u4f60\u5b89\u88c5\u7684\u65f6\u5019\u4fee\u6539\u4e86\uff0c\u8bf7\u6ce8\u610f\u4fee\u6539\u3002<\/p>\n<p>\u63a8\u8350\u5b66\u4e60\uff1a<\/p>\n<p>\u5728includechannelunit.func.php\u6587\u4ef6\u5e95\u90e8\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre>\/*\u6811\u5f62\u680f\u76ee\u8865\u5145\uff0c\u83b7\u53d6\u4e8c\u7ea7\uff0csan\u7ea7\uff0c\u56db\u7ea7\u680f\u76ee\u5217\u8868\/&nbsp;\n&nbsp;&nbsp;\nfunction&nbsp;getProductTree($typeid)\n&nbsp;&nbsp;\n{\n&nbsp;&nbsp;\n$linkList&nbsp;=&nbsp;\"\";\n&nbsp;&nbsp;\n$dsql&nbsp;=&nbsp;new&nbsp;DedeSql(false);\n&nbsp;&nbsp;\n$dsql-&amp;gt;SetQuery(\"select&nbsp;ID,typedir,typename,isdefault&nbsp;from&nbsp;dede_arctype&nbsp;where&nbsp;reID&nbsp;=&nbsp;'$typeid'&nbsp;order&nbsp;by&nbsp;sortrank\");\n&nbsp;&nbsp;\n$dsql-&amp;gt;Execute();\n&nbsp;&nbsp;\nwhile($row=$dsql-&amp;gt;GetObject())\n&nbsp;&nbsp;\n{\n&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;$typelink&nbsp;=&nbsp;GetTypeUrl($row-&amp;gt;id,MfTypedir($row-&amp;gt;typedir),$row-&amp;gt;isdefault,$row-&amp;gt;defaultname,$row-&amp;gt;ispart,$row-&amp;gt;namerule2,$row-&amp;gt;moresite,$row-&amp;gt;siteurl,$row-&amp;gt;sitepath);\n&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;$linkList&nbsp;.=&nbsp;\"\n&lt;div&gt;&lt;a&gt;&lt;b&gt;\".$row-&amp;gt;typename.\"&lt;\/b&gt;&lt;\/a&gt;&lt;\/div&gt;\n\n\";\n&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;$linkList&nbsp;.=&nbsp;getSonClass($row-&amp;gt;ID);\n&nbsp;&nbsp;\n}\n&nbsp;&nbsp;\n$dsql-&amp;gt;Close();\n&nbsp;&nbsp;\nreturn&nbsp;$linkList;\n&nbsp;&nbsp;\n}\n&nbsp;&nbsp;\n\/\/\u83b7\u5f97\u5c0f\u7c7b\u680f\u76ee\u94fe\u63a5\n&nbsp;&nbsp;\nfunction&nbsp;getSonClass($parentid)\n&nbsp;&nbsp;\n{\n&nbsp;&nbsp;\n$linkList&nbsp;=&nbsp;\"\";\n&nbsp;&nbsp;\n$dsql&nbsp;=&nbsp;new&nbsp;DedeSql(false);\n&nbsp;&nbsp;\n$dsql-&amp;gt;SetQuery(\"Select&nbsp;ID,typedir,typename,isdefault&nbsp;From&nbsp;dede_arctype&nbsp;where&nbsp;reID='$parentid'&nbsp;order&nbsp;by&nbsp;sortrank\");\n&nbsp;&nbsp;\n$dsql-&amp;gt;Execute($parentid);\n&nbsp;&nbsp;\nwhile($row=$dsql-&amp;gt;GetObject($parentid))\n&nbsp;&nbsp;\n{\n&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;$typelink&nbsp;=&nbsp;GetTypeUrl($row-&amp;gt;id,MfTypedir($row-&amp;gt;typedir),$row-&amp;gt;isdefault,$row-&amp;gt;defaultname,$row-&amp;gt;ispart,$row-&amp;gt;namerule2,$row-&amp;gt;moresite,$row-&amp;gt;siteurl,$row-&amp;gt;sitepath);\n&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;$linkList&nbsp;.=&nbsp;\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<li><\/li>\n<p> &#8220;; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;$linkList&nbsp;.=&nbsp;getSonClass2($row-&gt;ID); &nbsp;&nbsp; } &nbsp;&nbsp; return&nbsp;$linkList; &nbsp;&nbsp; } &nbsp;&nbsp; function&nbsp;getSonClass2($parentid) &nbsp;&nbsp; { &nbsp;&nbsp; $linkList&nbsp;=&nbsp;&#8220;&#8221;; &nbsp;&nbsp; $dsql&nbsp;=&nbsp;new&nbsp;DedeSql(false); &nbsp;&nbsp; $dsql-&gt;SetQuery(&#8220;Select&nbsp;ID,typedir,typename,isdefault&nbsp;From&nbsp;dede_arctype&nbsp;where&nbsp;reID=&#8217;$parentid&#8217;&nbsp;order&nbsp;by&nbsp;sortrank&#8221;); &nbsp;&nbsp; $dsql-&gt;Execute($parentid); &nbsp;&nbsp; while($row=$dsql-&gt;GetObject($parentid)) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;$typelink&nbsp;=&nbsp;GetTypeUrl($row-&gt;id,MfTypedir($row-&gt;typedir),$row-&gt;isdefault,$row-&gt;defaultname,$row-&gt;ispart,$row-&gt;namerule2,$row-&gt;moresite,$row-&gt;siteurl,$row-&gt;sitepath); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;$linkList&nbsp;.=&nbsp;&#8221; <\/p>\n<li><\/li>\n<p> &#8220;; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;$linkList&nbsp;.=&nbsp;getSonClass3($row-&gt;ID); &nbsp;&nbsp; } &nbsp;&nbsp; return&nbsp;$linkList; &nbsp;&nbsp; } &nbsp;&nbsp; function&nbsp;getSonClass3($parentid) &nbsp;&nbsp; { &nbsp;&nbsp; $linkList&nbsp;=&nbsp;&#8220;&#8221;; &nbsp;&nbsp; $dsql&nbsp;=&nbsp;new&nbsp;DedeSql(false); &nbsp;&nbsp; $dsql-&gt;SetQuery(&#8220;Select&nbsp;ID,typedir,typename,isdefault&nbsp;From&nbsp;dede_arctype&nbsp;where&nbsp;reID=&#8217;$parentid&#8217;&nbsp;order&nbsp;by&nbsp;sortrank&#8221;); &nbsp;&nbsp; $dsql-&gt;Execute($parentid); &nbsp;&nbsp; while($row=$dsql-&gt;GetObject($parentid)) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;$typelink&nbsp;=&nbsp;GetTypeUrl($row-&gt;id,MfTypedir($row-&gt;typedir),$row-&gt;isdefault,$row-&gt;defaultname,$row-&gt;ispart,$row-&gt;namerule2,$row-&gt;moresite,$row-&gt;siteurl,$row-&gt;sitepath); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;$linkList&nbsp;.=&nbsp;&#8221; <\/p>\n<li><\/li>\n<p> &#8220;; &nbsp;&nbsp; } &nbsp;&nbsp; return&nbsp;$linkList; &nbsp;&nbsp; } \/*\u6811\u5f62\u680f\u76ee\u8865\u5145*\/ <\/p>\n<p>2\u3001\u5728\u6a21\u677f\u91cc\u7528<\/p>\n<pre>{dede:channel&nbsp;function='getProductTree(2)'}{\/dede:channel}\u3000<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8c03\u7528\u5373\u53ef\u3002\u8fd9\u91ccgetProductTree(2)\u4e2d\u7684 2 \u662f\u4ea7\u54c1\u5c55\u793a\u7684\u680f\u76eeID\u3002\u5982\u679c\u4f60\u7684\u662f\u5176\u4ed6\u7684\uff0c\u8bf7\u4f5c\u76f8\u5e94\u4fee\u6539\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fDedeCms\u600e\u4e48\u83b7\u53d6\u4efb\u610f\u680f\u76eeN\u7ea7\u5217\u8868\u94fe\u63a5\u6811\u5f62\u83dc\u5355\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>\u600e\u4e48\u83b7\u53d6\u4efb\u610f\u680f\u76een\u7ea7\u5217\u8868\u94fe\u63a5\u6811\u5f62\u83dc\u5355\uff1f DedeCms\u83b7\u53d6\u4efb\u610f\u680f\u76eeN\u7ea7\u5217\u8868\u94fe\u63a5\u6811\u5f62\u83dc\u5355\uff0c\u5c0f\u7f16\u63d0\u793a\uff0c\u4e0b\u8fb9\u7684\u4fee\u6539\u65b9\u6cd5\uff0c\u9002\u7528\u4e8eDedeCMS\u9ed8\u8ba4\u7684\u8868\u524d\u7f00\uff0c\u5982\u679c\u4f60\u5b89\u88c5\u7684\u65f6\u5019\u4fee\u6539\u4e86\uff0c\u8bf7\u6ce8\u610f\u4fee\u6539\u3002 \u63a8\u8350\u5b66\u4e60\uff1a \u5728includechannelunit.func.php\u6587\u4ef6\u5e95\u90e8\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a \/*\u6811\u5f62\u680f\u76ee\u8865\u5145\uff0c\u83b7\u53d6\u4e8c\u7ea7\uff0csan\u7ea7\uff0c\u56db\u7ea7\u680f\u76ee\u5217\u8868\/&nbsp; &nbsp;&nbsp; function&nbsp;getProductTree($typeid) &nbsp;&nbsp; { &nbsp;&nbsp; $linkList&nbsp;=&nbsp;&#8220;&#8221;; &nbsp;&nbsp; $dsql&nbsp;=&nbsp;new&nbsp;DedeSql(false); &nbsp;&nbsp; $dsql-&amp;gt;SetQuery(&#8220;select&nbsp;ID,typedir,typename,isdefault&nbsp;from&nbsp;dede_arctype&nbsp;where&nbsp;reID&nbsp;=&nbsp;&#8216;$typeid&#8217;&nbsp;order&nbsp;by&nbsp;sortrank&#8221;); &nbsp;&nbsp; $dsql-&amp;gt;Execute(); &nbsp;&nbsp; while($row=$dsql-&amp;gt;GetObject()) &nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;$typelink&nbsp;=&nbsp;GetTypeUrl($row-&amp;gt;id,MfTypedir($row-&amp;gt;typedir),$row-&amp;gt;isdefault,$row-&amp;gt;defaultname,$row-&amp;gt;ispart,$row-&amp;gt;namerule2,$row-&amp;gt;moresite,$row-&amp;gt;siteurl,$row-&amp;gt;sitepath); &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;$linkList&nbsp;.=&nbsp;&#8221; &lt;div&gt;&lt;a&gt;&lt;b&gt;&#8221;.$row-&amp;gt;typename.&#8221;&lt;\/b&gt;&lt;\/a&gt;&lt;\/div&gt; &#8220;; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;$linkList&nbsp;.=&nbsp;getSonClass($row-&amp;gt;ID); &nbsp;&nbsp; } &nbsp;&nbsp; $dsql-&amp;gt;Close(); &nbsp;&nbsp; return&nbsp;$linkList; &nbsp;&nbsp; } &nbsp;&nbsp; \/\/\u83b7\u5f97\u5c0f\u7c7b\u680f\u76ee\u94fe\u63a5 &nbsp;&nbsp; function&nbsp;getSonClass($parentid) &nbsp;&nbsp; { &nbsp;&nbsp; $linkList&nbsp;=&nbsp;&#8220;&#8221;; &nbsp;&nbsp; $dsql&nbsp;=&nbsp;new&nbsp;DedeSql(false); &nbsp;&nbsp; $dsql-&amp;gt;SetQuery(&#8220;Select&nbsp;ID,typedir,typename,isdefault&nbsp;From&nbsp;dede_arctype&nbsp;where&nbsp;reID=&#8217;$parentid&#8217;&nbsp;order&nbsp;by&nbsp;sortrank&#8221;); &nbsp;&nbsp; $dsql-&amp;gt;Execute($parentid); &nbsp;&nbsp; while($row=$dsql-&amp;gt;GetObject($parentid)) &nbsp;&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-30331","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30331","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=30331"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30331\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=30331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=30331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=30331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}