dedecms下修改class文件支持文章列表按权重排序
2016-03-06 14:26
375 查看
在模版文件中,list标签或者是arclist标签中添加,orderby='weight' orderway='asc'(权重越小,就越靠前) 在include/arc.listview.class.php文件中找到: //如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢) if(preg_match('/hot|click|weight|lastpost/', $orderby)) { $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname, tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id $addJoin WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row"; } 在click后面添加‘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"; } 找到排序方式添加 else if($orderby=="weight") { $ordersql = " ORDER BY arc.weight $orderWay"; } 即可
相关文章推荐
- 初学Python-搞了一个linux用户登录监测小工具
- JVM调优总结
- Metasploit 学习记录
- 理解spring
- java学习笔记(3)基本概念之抽象类和接口
- [LeetCode]131. Palindrome Partitioning
- java学习笔记(2)基本概念之面向对象大纲
- JavaScript中利用jQuery绑定事件的几种方式小结
- java学习笔记(1)基本概念之成员
- 华为oj 将真分数分解为埃及分数
- Leetcode 238 Product of Array Except Self 时间O(n)和空间O(1)解法
- 第一周的学习进度条
- iOS开发系列--并行开发详解
- TYVJ 1074 武士风度的牛
- TYVJ 1074 武士风度的牛
- Java虚拟机工作过程学习总结
- Fragment为什么须要无参构造方法
- 一个单机棋盘式半即时解谜RPG的开发与反思、2
- 各大代码托管服务器的分析比较
- MySQL表结构优化、数据类型选择方法