本文实例讲述了DEDECMS列表页文档按权重排序的实现方法。分享给大家供大家参考。具体实现方法如下:
1、在list_artcile.htm模板中使用:
{dede:list pagesize='12' orderby='weight' orderway='asc'}
2、然后修改include目录下的arc.listview.class.php,查找else if($orderby=="lastpost
else if($orderby=="weight") {
$ordersql = " order by arc.weight $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";
}
3、同样是这个文件,查找“if(ereg('hot|click|lastpost',$orderby))”改为:
if(ereg('hot|click|weight|lastpost',$orderby))
上面三个步骤,即可实现列表页内容按权重排序,越小越靠前.