第一种:根据所在栏目ID自动判断显示所在栏目的文章数
(<span>[field:ID runphp='yes'] @me = GetTotalArc(@me);[/field:ID]</span>)
第二种:指定栏目ID
- {dede:sql sql="SELECT count( ID ) AS c FROM dede_archives where typeid = 栏目id "}
- 本月更新:[field:c /]篇 {/dede:sql}
第三种:DedeCMS栏目文章数量统计调用,栏目名称按照文章数量排列
- {dede:sql sql='SELECT d.typename,d.id,count(da.id)
- as heji FROM dede_arctype d left join dede_archives
- da on dda.typeid=d.id where d.reid=0 group by d.typename order by heji desc limit 0,8;'}
- <span class="text_1"><span class="count">[[field:heji/]篇]</span>
- <a href="http://www.dedecmsmuban.com/plus/list.php
- ?tid=[field:id/]">[field:typename/]共投递稿件</a></span><br /> {/dede:sql}
第四种:
- function GetTotalArc($tid)
- {
- global $dsql;
- $sql = GetSonIds($tid);
- $row = $dsql->GetOne("Select count(id) as dd From dede_archives where typeid in({$sql})");
- return $row['dd']; }
在htm 最下方添加:
- {dede:channel type='top' row='8'}
- <LI>[field:typename/](<span>
- [field:ID runphp='yes'] @me = GetTotalArc(@me);
- [/field:ID]</span>)</LI>{/dede:channel}
- function GetTotalArc($tid2){
- global $dsql;
- $sql = GetSonIds($tid2);
- $row = $dsql->GetOne("Select count(id) as dd From dede_archives where typeid2 in({$sql})");
- return $row['dd']; }
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}
以上就是织梦dedecms怎么调用栏目文章数 统计对应栏目的文章数。我以为如此这般,我便如此这般!更多关于织梦dedecms怎么调用栏目文章数 统计对应栏目的文章数请关注haodaima.com其它相关文章!