織夢的arclist標(biāo)簽可以按照文章點擊次數(shù)、發(fā)布日期、得分等進行排序,今天有個客戶需要按照軟件下載次數(shù)進行排列,于是做了簡單二次開發(fā),首先找到include目錄下面的taglib目錄里的arclist.lib.php文件在376行后加入如下代碼
if($orderby == 'down')
{
$sql = "select SUM(downloads) as down_num,id from dede_downloads group by id ORDER BY down_num DESC LIMIT 0,15";
$dsql->Execute('me',$sql);
while($drow = $dsql->GetArray() )
{
$arr[] = $drow['id'];
}
$dstr = implode(",",$arr);
if($orwhere!='')
{
$orwhere .= " AND arc.id in($dstr)";
}else{
$orwhere .= " where arc.id in($dstr)";
}
$ordersql = 'ORDER BY field(arc.id,'.$dstr.')';
}