织梦列表页list标签weight权重排序方法:(注:红色标记部分就是修改处)
1、打开include/arc.listview.class.php
2、找到 else if($orderby=="lastpost") {
$ordersql = " ORDER BY arc.lastpost $orderWay";
}
替换
else if($orderby=="lastpost") {
$ordersql = " ORDER BY arc.lastpost $orderWay";
}
else if($orderby=="weight") {
$ordersql = " ORDER BY arc.weight $orderWay";
}
3、找到
//如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢)
if(preg_match('/hot|click|lastpost/', $orderby))
替换
//如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢)
if(preg_match('/hot|click|lastpost|weight/', $orderby))
4、找到$query = "SELECT id FROM `dede_arctiny` arc WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row ";
替换$query = "SELECT id FROM `dede_archives` arc WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row ";
5、标签调用:
{dede:list orderby='weight' pagesize ='3'}
{/dede:list}
接下来{dede:list}标签就支持了按权重排序的调用了。