织梦dedecms 5.7 list按weight权重排序/支持按权重排序

2018-12-0717:49:30网站建设与开发Comments1,784 views字数 649阅读模式

1、找到”根目录\include\arc.listview.class.php”文件。
2、修改代码:在文件第727行处添加按weight排序判断代码。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/8555.html

//排序方式
$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行处找到此段代码文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/8555.html

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

并添加|weight。
4、标签调用:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/8555.html

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

这样{dede:list}标签就支持了按权重排序的调用,并且动静态状态下测试均成功!文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/8555.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/cms/8555.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定