织梦的arclist标签可以按照文章点击次数、发布日期、得分等进行排序,今天有个客户需要按照软件下载次数进行排列,于是做了简单二次开发,首先找到include目录下面的taglib目录里的arclist.lib.php文件在376行后加入如下代码
01
if($orderby == ‘down’)
02
{
03
$sql = “select SUM(downloads) as down_num,id from dede_downloads group by id ORDER BY down_num DESC LIMIT 0,15”;
04
$dsql->Execute(‘me’,$sql);
05
while($drow = $dsql->GetArray() )
06
{
07
$arr[] = $drow[‘id’];
08
}
09
$dstr = implode(“,”,$arr);
10
if($orwhere!=”)
11
{
12
$orwhere .= ” AND arc.id in($dstr)”;
13
}else{
14
$orwhere .= ” where arc.id in($dstr)”;
15
}
16
$ordersql = ‘ORDER BY field(arc.id,’.$dstr.’)’;
17
}