DEDECMS給list標簽加上多字段排序功能

2020-12-09


dedecms的list標簽orderby屬性只支持按一個字段排序,假如想多個字段排序的話,就需要對PHP舉辦修改,使其可以支持多字段排序,修改如下:

打開include/arc.listview.class.php,找到:
 

01 //假如不消默認的sortrank或id排序,利用連系查詢(數據量大時很是遲鈍)
02        if(preg_match('/hot|click|lastpost|title/', $orderby))
03        {
04            $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,
05           tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
06           $addField
07           FROM `js_archives` arc
08           LEFT JOIN `js_arctype` tp ON arc.typeid=tp.id
09           $addJoin
10           WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row";
11        }
12        
0
凯时平台