DedeCMS让{dede:list}标签支持weight权重排序
类别:建站知识   时间:06-11

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:listorderby='weight' orderway='asc'}

  这样{dede:list}标签就支持了按权重排序的调用,并且动静态状态下测试均成功!

智慧半岛,是一家专注于青岛网站建设青岛网站开发的青岛网络公司,Copyright ©2007-2019 Ebandao.Cn 版权所有 All Rights Reserved.(建议在1366x768以上的浏览器中访问)鲁ICP备08014496号

13153297890