第一种:根据所在栏目ID自动判断显示所在栏目的文章数
(<span>[field:ID runphp='yes'] @me = GetTotalArc(@me);[/field:ID]</span>)
第二种:指定栏目ID
第三种:DedeCMS栏目文章数量统计调用,栏目名称按照文章数量排列
第四种:
修改include/common.func.php 在最后加入代码: //*****统计栏目文章数在htm 最下方添加:
function dynamic_num($current_id){
global $dsql;
$t_num = $dsql->GetOne("select count(*) as num from `dede_archives` where typeid='$current_id'");
if(is_array($t_num)){
return "本栏目共有".$t_num[num]."篇文章";
}else{
return "本栏目共有0篇文章" ;
}
}
在列表页中这样调用:
{dede:type}[field:id function="dynamic_num(@me)" /]{/dede:type}
{dede:sql sql="SELECT count( * ) AS c FROM cmsxx_archives
WHERE pubdate > UNIX_TIMESTAMP( CURDATE( ) ) "}
<li class="count">今日更新:<span>[field:c/]</span> 篇</li>
{/dede:sql}
{dede:sql sql="Select count(ID) as c From cmsxx_archives
WHERE FROM_UNIXTIME(pubdate,'%m')=month(curdate())"}
<li class="count">当月更新:<span>[field:c/]</span> 篇</li>
{/dede:sql}
{dede:sql sql="select count(*) as c from cmsxx_archives}
<li class="count">共有文章:<span>[field:c/]</span> 篇</li>
{/dede:sql}
{dede:sql sql="select sum(click) as c from cmsxx_archives"}
<li class="count">总共阅读:<span>[field:c/]</span> 人次</li>
{/dede:sql}
{dede:sql sql="select count(mid) as c from cmsxx_member "}
<li class="count">共有会员:<span>[field:c/]</span> 名</li>
{/dede:sql}
还可以指定栏目ID,例如:
{dede:sql sql="select count(*) as c from cmsxx_archives where channel in(1,2,3,5,6,9)"}
<li class="count">共有文章:<span>[field:c/]</span> 篇</li>
{/dede:sql}