帝国CMS模板当前专题或者指定专题信息数量统计的几种方法

分类栏目:帝国学院

发布于

1、统计当前专题内的文章数量 
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsztinfo where ztid='$GLOBALS[navclassid]'")?>

2、统计专题文章数量
①sql代码

<?
$num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsztinfo where ztid=专题id");
echo $num;
?>


注释:(ztid=专题id 可以修改为  ztid=ztid)


②灵动标签+php

[e:loop={"select ztpath,ztname,ztid from [!db.pre!]enewszt where zcid=0",36,24,0}]
<li>
<a href="<?=$bqr[ztpath]?>"><?=$bqr[ztname]?></a>
&nbsp;(<? $num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsztinfo where ztid='$bqr[ztid]'");
echo $num;?>)
</li>        
[/e:loop]

 

查看原内容