网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 生活知识 知识问答

dede:list及dede:arclist 按权重排序的方法

时间:2024-10-13 19:01:15

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

2、修改代码:在文件第727行处添加按weight排序判断代码(红色部分为新添加代码)。//排序方式$ordersql = '';if($orderb烤恤鹇灭y=="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:listorderby='weight' orderway='asc'}  这样{dede:list}标签就支持了按权重排序的调用,并且动静态状态下测试均成功!

© 2026 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com