AB模板网:是一家专注于网站模板,织梦模板下载的网站,专注网站源码,源码下载,dede模板,为广大站长提供网站模板和织梦模板等素材.
用户名:
密码:
注册

织梦源码,模板王

VIP

织梦如何按照软件下载次数排列

www.adminbuy.cc / 2019-09-23
织梦的arclist标签可以按照文章点击次数、发布日期、得分等进行排序,今天有个客户需要按照软件下载次数进行排列,于是做了简单二次开发,首先找到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.")";
 }