下面就是织梦cms列表页{dede:list}标签实现按文章权重weight排序的方法:

1、找到根目录include/arc.listview.class.php文件。

2、修改代码:

在文件第727行处添加按weight排序判断代码(红色部分为新添加代码)。

//排序方式 $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、再在第778行处找到此段代码

//如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢)   if(preg_match('/hot|click|lastpost|weight/', $orderby))

并添加红色部分内容。

4、标签调用:

{dede:list orderby='weight' orderway='asc'}

按照以上方法,织梦dedecms列表页{dede:list}标签就支持了按权重排序的调用,并且动静态状态下测试均成功!