织梦dedecms dede:list如何按照权重排序

织梦的dede:list标签默认是不能按照权重排序的,需要对程序进行修改。
打开include/arc.listview.class.php这个文件
1.找到下面这段代码,大概在761行左右

$ordersql = '';
        if($orderby=="senddate" || $orderby=="id") {
            $ordersql=" ORDER BY arc.id $orderWay";
        }
        else if($orderby=="hot" || $orderby=="click") {
            $ordersql = " ORDER BY arc.click $orderWay";
        }
        else if($orderby=="lastpost") {
            $ordersql = "  ORDER BY arc.lastpost $orderWay";
        }
        else {
            $ordersql=" ORDER BY arc.sortrank $orderWay";
        }

把它改成下面这段代码

$ordersql = '';
        if($orderby=="senddate" || $orderby=="id") {
            $ordersql=" ORDER BY arc.id $orderWay";
        }
        else if($orderby=="hot" || $orderby=="click") {
            $ordersql = " ORDER BY arc.click $orderWay";
        }
        else if($orderby=="lastpost") {
            $ordersql = "  ORDER BY arc.lastpost $orderWay";
        }
       else if($orderby=="weight") {
            $ordersql = "  ORDER BY arc.weight $orderWay";
        }
        else {
            $ordersql=" ORDER BY arc.sortrank $orderWay";
        }

2.找到下面这行代码,大概在809行左右

if(preg_match('/hot|click|lastpost/', $orderby))

改成下面这行代码

if(preg_match('/hot|click|weight|lastpost/', $orderby))

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: