让dedecms支持 dede:list 标签按权重weight排序:
1.打开include目录下的arc.listview.class.php文件,找到以下代码:
.............................
else if($orderby=="lastpost") {
$ordersql = " ORDER BY arc.lastpost $orderWay";
}
在此后插入下面这一句:
else if($orderby=="weight") {
$ordersql = " ORDER BY arc.weight $orderWay";
}
然后查找:if(preg_match('/hot|click|lastpost/', $orderby))
修改为:if(preg_match('/hot|click|weight|lastpost/', $orderby))
2.前台调用:
{dede:list orderby='weight' orderway='asc'} //权重越小越靠前
dedecms默认是降序排序,也就是权重越小越靠前。
要实现越重越大越靠前,只需要将上述代码中的 orderway='asc' 去掉就可以了。
