dedecms织梦系统如何按照软件下载次数排序?
时间:2016-04-07 11:48:58
来源:ucbug下载站
作者:ucbug下载站
dedecms织梦的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.')';
}
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.')';
}
相关文章
简介:织梦CMS(DedeCMS)是集简单、健壮、灵活、开源几大特点的开源内容管理系统,是国内开源CMS的领先品牌,目前程序安装量已达七十万,超过六成的站点正在使用织梦CMS或基于织梦CMS核心开发。升级功能(一)、人性化功能:1、允许许用户选择栏目链接为不带默认页的类型,即是type
立即下载
推荐文章
文章排行