• 观点

    互联网+时代,说建站,谈运营与网络营销

    DEDECMS列表标签按照下载次数排序

    时间:2020-12-15

    DEDECMS按照下载次数排序,排序在SQL语句里无非就是order by 下载次数 desc,知道了这个然后我们就看需要改哪里了。

    找到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.')';
    }

    0
    首页
    案例
    关于
    联系