织梦CMS列表页自动统计當前栏目的文档总数
第I.种
更多精彩就在: 51免费论文网|www.jxszl.com
:runphp=’yes’
利用织梦自带的runphp参数来实现这个功能,只需要在您需要显示统计数量的地方直接加入以下代码:
{dede:field.typeidrunphp=yes}
global$dsql;
$row=$dsql->GetOne("selectcount(*)asddfromdede_archiveswheretypeid=@me");
@me=$row[dd];
{/dede:field.typeid}
第II种:function.我们通常所说的函数,在织梦(DedeCMS)中,我们可以利用自定义函数来实现各种效果,实现的具体方法为:
在/include/extend.func.php文件的?>上I.行加入以下代码:
function_GetTypeNum($tid){
global$dsql;
$row=$dsql->GetOne("selectcount(*)asddfromdede_archiveswheretypeid=$tid");
return$row[dd];
}
在模板需求统计栏目文档的地方加入以下代码:
{dede:field.typeidfunction="GetTypeNum(@me)"/}
原文链接:http://www.jxszl.com/biancheng/dedecms/74868.html
热门阅读