让栏目显示信息数
编辑发布:飞将军
将以下代码粘贴到 do/global.php ?>上方
function shownums($fid){
global $db,$pre;
$rs=$db->get_one("select count(*) as nums from {$pre}article where fid=$fid");
return "$rs[nums]";
}
二、在需要显示栏目信息数的地方加上以下代码
shownums(栏目ID)
三、举例说明
拿默认安装的系统测试的
打开\template\default\side_sort\2.htm
<!--
EOT;
foreach($array2 AS $key2=>$array2){
$nums=shownums($array2[0]);
print <<<EOT
-->
<td><div style="margin:3px;background:#eee;border:1px solid #ccc;line-height:25px;text-align:center;"><a style="font-size:14px;" href="list.php?fid=$array2[0]">$array2[1]( $nums)</a></div></td>
<!--
EOT;
}print <<<EOT
-->
以上红色代码为显示栏目信息数。
效果如下
|
点击率:1063
|
|