第一种:runphp=’yes’
利用织梦自带的runphp参数来实现这个功能,只需要在您需要显示统计数量的地方直接加入以下代码:
{dede:field.typeid runphp='yes'}
global $dsql;
$row = $dsql->GetOne("select count(*) as dd from dede_archives where typeid = @me");
@me = $row['dd'];
{/dede:field.typeid}
第二种:function。我们通常所说的函数,在织梦(DedeCMS)中,我们可以利用自定义函数来实现各种效果,实现的具体方法为:
在/include/extend.func.php文件的?>上一行加入以下代码:
function _GetTypeNum($tid){
global $dsql;
$row = $dsql->GetOne("select count(*) as dd from dede_archives where typeid = $tid");
return $row['dd'];
}
在模板需求统计栏目文档的地方加入以下代码:
{dede:field.typeid function="GetTypeNum(@me)"/}
Pbootcms问题解决
请点击在线联系我们【点击咨询解决问题】 如果您有任何Pbootcms问题,我们将免费为您写解决教程!