打開(kāi) include/common.func.php文件,在這個(gè)php文件里的?>之前,加上以下代碼:
function GetTotalArc($tid){
global $dsql;
$sql = GetSonIds($tid);
$row = $dsql->GetOne("Select count(id) as dd From dede_archives where typeid
in({$sql})");
return $row['dd'];
}
//統(tǒng)計(jì)當(dāng)前欄目信息數(shù)
function dynamic_num($current_id){
global $dsql;
//讀取當(dāng)前欄目的子ID
$sql = "SELECT id FROM `dede_arctype` WHERE id='$current_id' ||
topid='$current_id'";
$dsql->SetQuery($sql);
$dsql->Execute();
while($row = $dsql->GetArray()){
$arr[]=$row[id];
}
foreach($arr as $key=>$value){
$type .= $value . ',';
}
$ty= "".$type."0";
//echo $ty;
$t_num = $dsql->GetOne("select count(*) as num from `dede_archives` where typeid
in($ty)");
//echo $t_num[num];
if(is_array($t_num)){
return " ".$t_num[num]." ";
}else{
return "0" ;
}
}
然后在列表模板里調(diào)用模板里的調(diào)用以下代碼代碼:
{dede:type}[field:id function="dynamic_num(@me)" /]{/dede:type}
這樣就修改完成了.
更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄