dedecms 文章根据 权重排序

找到 /include/arc.listview.class.php

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";
        }
if(preg_match('/hot|click|weight|lastpost/', $orderby)) // 新增
        {
            $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,
           tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
           $addField
           FROM `#@__archives` arc
           LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id
           $addJoin
           WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row";
        }

模板中  :

 orderby='weight' orderway='asc'

猜你喜欢

转载自www.cnblogs.com/Skate0rDie/p/10737320.html