强大号码库资源任选,方便,快捷,快速开通。
咨询热线:400-1100-266
第一种:根据所在栏目ID自动判断显示所在栏目的文章数
(<span>[field:ID runphp='yes'] @me = GetTotalArc(@me);[/field:ID]</span>)
第二种:指定栏目ID
- {dede:sqlsql="SELECTcount(ID)AScFROMdede_archiveswheretypeid=栏目id"}
- 本月更新:[field:c/]篇{/dede:sql}
第三种:DedeCMS栏目文章数量统计调用,栏目名称按照文章数量排列
- {dede:sqlsql='SELECTd.typename,d.id,count(da.id)
- ashejiFROMdede_arctypedleftjoindede_archives
- daondda.typeid=d.idwhered.reid=0groupbyd.typenameorderbyhejidesclimit0,8;'}
- <spanclass="text_1"><spanclass="count">[[field:heji/]篇]</span>
- <ahref="http://www.dedecmsmuban.com/plus/list.php
- ?tid=[field:id/]">[field:typename/]共投递稿件</a></span><br/>{/dede:sql}
第四种:
- functionGetTotalArc($tid)
- {
- global$dsql;
- $sql=GetSonIds($tid);
- $row=$dsql->GetOne("Selectcount(id)asddFromdede_archiveswheretypeidin({$sql})");
- return$row['dd'];}
在htm 最下方添加:
- {dede:channeltype='top'row='8'}
- <LI>[field:typename/](<span>
- [field:IDrunphp='yes']@me=GetTotalArc(@me);
- [/field:ID]</span>)</LI>{/dede:channel}
- functionGetTotalArc($tid2){
- global$dsql;
- $sql=GetSonIds($tid2);
- $row=$dsql->GetOne("Selectcount(id)asddFromdede_archiveswheretypeid2in({$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}