{"id":30476,"date":"2024-11-25T10:03:01","date_gmt":"2024-11-25T02:03:01","guid":{"rendered":"https:\/\/fwq.ai\/blog\/30476\/"},"modified":"2024-11-25T10:03:01","modified_gmt":"2024-11-25T02:03:01","slug":"dedecms%e6%80%8e%e4%b9%88%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e6%a0%8f%e7%9b%ae%e5%8f%8a%e6%89%80%e6%9c%89%e5%ad%90%e6%a0%8f%e7%9b%ae%e7%9a%84%e6%96%87%e7%ab%a0%e6%95%b0%e9%87%8f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/30476\/","title":{"rendered":"DEDECMS\u600e\u4e48\u83b7\u53d6\u5f53\u524d\u680f\u76ee\u53ca\u6240\u6709\u5b50\u680f\u76ee\u7684\u6587\u7ae0\u6570\u91cf"},"content":{"rendered":"<p style=\"text-align: center\"><strong><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/020\/5dfad7984b155758.jpg\" class=\"aligncenter\" title=\"DEDECMS\u600e\u4e48\u83b7\u53d6\u5f53\u524d\u680f\u76ee\u53ca\u6240\u6709\u5b50\u680f\u76ee\u7684\u6587\u7ae0\u6570\u91cf\u63d2\u56fe\" alt=\"DEDECMS\u600e\u4e48\u83b7\u53d6\u5f53\u524d\u680f\u76ee\u53ca\u6240\u6709\u5b50\u680f\u76ee\u7684\u6587\u7ae0\u6570\u91cf\u63d2\u56fe\" \/><\/strong><\/p>\n<p><strong>\u600e\u4e48\u83b7\u53d6\u5f53\u524d\u680f\u76ee\u53ca\u6240\u6709\u5b50\u680f\u76ee\u7684\u6587\u7ae0\u6570\u91cf\uff1f<\/strong><\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u7528\u6765\u89e3\u51b3\u67e5\u8be2\u5f53\u524d\u680f\u76ee\u53ca\u5f53\u524d\u680f\u76ee\u4e0b\u6240\u6709\u5b50\u680f\u76ee\u7684\u6587\u7ae0\u603b\u6570\uff0c\u6dfb\u52a0\u5230\/include\/common.func.php&nbsp;<\/p>\n<p>\u6216\u8005 \/include\/extend.func.php\u4e2d\uff0c\u7136\u540e\u5728\u6a21\u677f\u4e2d\u8c03\u7528getTotalArcByTid(1)\u3002&nbsp;<\/p>\n<p>\u63a8\u8350\u5b66\u4e60\uff1a<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre>\/*&nbsp;\n*&nbsp;\u8fd4\u56de\u7b26\u5408\u8bb0\u5f55\u7684\u6587\u7ae0\u6570\u91cf&nbsp;\n*&nbsp;@description&nbsp;DEDE\u4e0d\u5141\u8bb8\u6267\u884c\u5b50\u67e5\u8be2\uff0c\u89e3\u51b3\u680f\u76ee\u4e0b\u6587\u7ae0\u7edf\u8ba1\u7684\u95ee\u9898&nbsp;\n*&nbsp;@param&nbsp;$level&nbsp;\u4e3a\u771f\u65f6\u67e5\u8be2\u6240\u6709\u5b50\u7c7b\u76ee&nbsp;\n*&nbsp;*\/&nbsp;\nfunction&nbsp;getTotalArcByTid($tid,&nbsp;$level=TRUE)&nbsp;{&nbsp;\nglobal&nbsp;$dsql;&nbsp;\n$level==TRUE&nbsp;&amp;amp;&amp;amp;&nbsp;$tid&nbsp;=&nbsp;GetSonTypeID($tid);&nbsp;\n$sql&nbsp;=&nbsp;\"SELECT&nbsp;count(id)&nbsp;as&nbsp;total&nbsp;from&nbsp;`dede_archives`&nbsp;where&nbsp;typeid&nbsp;in($tid)\";&nbsp;\n$result&nbsp;=&nbsp;$dsql-&amp;gt;GetOne($sql);&nbsp;\nreturn&nbsp;$result['total'];&nbsp;\n}&nbsp;\n\/*&nbsp;\n*&nbsp;\u9012\u5f52\u83b7\u53d6\u7b26\u5408\u6761\u4ef6\u7684\u5b50\u680f\u76ee&nbsp;\n*&nbsp;@param&nbsp;$tid&nbsp;\u680f\u76eeID&nbsp;\n*&nbsp;@return&nbsp;string&nbsp;\n*&nbsp;*\/&nbsp;\nfunction&nbsp;GetSonTypeID($tid)&nbsp;\n{&nbsp;\nglobal&nbsp;$dsql;&nbsp;\n$dsql-&amp;gt;SetQuery(\"Select&nbsp;id&nbsp;From&nbsp;`dede_arctype`&nbsp;where&nbsp;reid&nbsp;in($tid)&nbsp;And&nbsp;ishidden1&nbsp;order&nbsp;by&nbsp;sortrank\");&nbsp;\n$dsql-&amp;gt;Execute($tid);&nbsp;\n$typeid&nbsp;=&nbsp;'';&nbsp;\nwhile($row=$dsql-&amp;gt;GetObject($tid))&nbsp;\n{&nbsp;\n$typeid&nbsp;.=&nbsp;\"{$row-&amp;gt;id},\";&nbsp;\n$typeid&nbsp;.=&nbsp;GetSonTypeID($row-&amp;gt;id);&nbsp;\n}&nbsp;\nreturn&nbsp;trim($typeid,',');&nbsp;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8c03\u7528\u65b9\u6cd5\uff1a&nbsp;<\/p>\n<p>\u6a21\u677f\u4e2d\u8c03\u7528\u7684\u65b9\u6cd5\u4e00\u822c\u4e3a:&nbsp;<\/p>\n<pre>{dede:field.typeid&nbsp;function=\"getTotalArcByTid(@me)\"\/}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6216\u8005&nbsp;<\/p>\n<pre>[field:typeid&nbsp;function=\"getTotalArcByTid(@me)\"\/]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fDEDECMS\u600e\u4e48\u83b7\u53d6\u5f53\u524d\u680f\u76ee\u53ca\u6240\u6709\u5b50\u680f\u76ee\u7684\u6587\u7ae0\u6570\u91cf\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\u5f53\u524d\u680f\u76ee\u53ca\u6240\u6709\u5b50\u680f\u76ee\u7684\u6587\u7ae0\u6570\u91cf\uff1f \u4ee5\u4e0b\u4ee3\u7801\u7528\u6765\u89e3\u51b3\u67e5\u8be2\u5f53\u524d\u680f\u76ee\u53ca\u5f53\u524d\u680f\u76ee\u4e0b\u6240\u6709\u5b50\u680f\u76ee\u7684\u6587\u7ae0\u603b\u6570\uff0c\u6dfb\u52a0\u5230\/include\/common.func.php&nbsp; \u6216\u8005 \/include\/extend.func.php\u4e2d\uff0c\u7136\u540e\u5728\u6a21\u677f\u4e2d\u8c03\u7528getTotalArcByTid(1)\u3002&nbsp; \u63a8\u8350\u5b66\u4e60\uff1a \u4ee3\u7801\u5982\u4e0b: \/*&nbsp; *&nbsp;\u8fd4\u56de\u7b26\u5408\u8bb0\u5f55\u7684\u6587\u7ae0\u6570\u91cf&nbsp; *&nbsp;@description&nbsp;DEDE\u4e0d\u5141\u8bb8\u6267\u884c\u5b50\u67e5\u8be2\uff0c\u89e3\u51b3\u680f\u76ee\u4e0b\u6587\u7ae0\u7edf\u8ba1\u7684\u95ee\u9898&nbsp; *&nbsp;@param&nbsp;$level&nbsp;\u4e3a\u771f\u65f6\u67e5\u8be2\u6240\u6709\u5b50\u7c7b\u76ee&nbsp; *&nbsp;*\/&nbsp; function&nbsp;getTotalArcByTid($tid,&nbsp;$level=TRUE)&nbsp;{&nbsp; global&nbsp;$dsql;&nbsp; $level==TRUE&nbsp;&amp;amp;&amp;amp;&nbsp;$tid&nbsp;=&nbsp;GetSonTypeID($tid);&nbsp; $sql&nbsp;=&nbsp;&#8220;SELECT&nbsp;count(id)&nbsp;as&nbsp;total&nbsp;from&nbsp;`dede_archives`&nbsp;where&nbsp;typeid&nbsp;in($tid)&#8221;;&nbsp; $result&nbsp;=&nbsp;$dsql-&amp;gt;GetOne($sql);&nbsp; return&nbsp;$result[&#8216;total&#8217;];&nbsp; }&nbsp; \/*&nbsp; *&nbsp;\u9012\u5f52\u83b7\u53d6\u7b26\u5408\u6761\u4ef6\u7684\u5b50\u680f\u76ee&nbsp; *&nbsp;@param&nbsp;$tid&nbsp;\u680f\u76eeID&nbsp; *&nbsp;@return&nbsp;string&nbsp; *&nbsp;*\/&nbsp; function&nbsp;GetSonTypeID($tid)&nbsp; {&nbsp; global&nbsp;$dsql;&nbsp; $dsql-&amp;gt;SetQuery(&#8220;Select&nbsp;id&nbsp;From&nbsp;`dede_arctype`&nbsp;where&nbsp;reid&nbsp;in($tid)&nbsp;And&nbsp;ishidden1&nbsp;order&nbsp;by&nbsp;sortrank&#8221;);&nbsp; $dsql-&amp;gt;Execute($tid);&nbsp; $typeid&nbsp;=&nbsp;&#8221;;&nbsp; while($row=$dsql-&amp;gt;GetObject($tid))&nbsp; {&nbsp; $typeid&nbsp;.=&nbsp;&#8220;{$row-&amp;gt;id},&#8221;;&nbsp; $typeid&nbsp;.=&nbsp;GetSonTypeID($row-&amp;gt;id);&nbsp; }&nbsp; return&nbsp;trim($typeid,&#8217;,&#8217;);&nbsp; } \u767b\u5f55\u540e\u590d\u5236 \u8c03\u7528\u65b9\u6cd5\uff1a&nbsp; \u6a21\u677f\u4e2d\u8c03\u7528\u7684\u65b9\u6cd5\u4e00\u822c\u4e3a:&nbsp; {dede:field.typeid&nbsp;function=&#8221;getTotalArcByTid(@me)&#8221;\/} \u767b\u5f55\u540e\u590d\u5236 \u6216\u8005&nbsp; [field:typeid&nbsp;function=&#8221;getTotalArcByTid(@me)&#8221;\/] \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u5c31\u662fDEDECMS\u600e\u4e48\u83b7\u53d6\u5f53\u524d\u680f\u76ee\u53ca\u6240\u6709\u5b50\u680f\u76ee\u7684\u6587\u7ae0\u6570\u91cf\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-30476","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30476","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=30476"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30476\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=30476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=30476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=30476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}