找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1046|回复: 0

[分享] DEDE 5.7 首页arclist增加按权重排序

[复制链接]
发表于 2018-2-25 14:09:14 | 显示全部楼层 |阅读模式 来自 中国–河南–新乡
1、在织梦系统中找到以下目录\include\taglib中的arclist.lib.php文件并打开
   大约在74 、75行找到:
      // arclist是否需要weight排序,默认为"N",如果需要排序则设置为"Y"
    $isweight = $ctag->GetAtt(‘isweight’);
把这行修改为:
  $weight = $ctag->GetAtt(‘weight’);
大约在327行找到
  
  1. //文档排序的方式
  2.     $ordersql = ”;
  3.     if($orderby==’hot’ || $orderby==’click’) $ordersql = " ORDER BY arc.click $orderWay";
  4.     else if($orderby == ‘sortrank’ || $orderby==’pubdate’) $ordersql = " ORDER BY arc.sortrank $orderWay";
  5.     else if($orderby == ‘id’) $ordersql = "  ORDER BY arc.id $orderWay";
  6.     else if($orderby == ‘near’) $ordersql = " ORDER BY ABS(arc.id – ".$arcid.")";
  7.     else if($orderby == ‘lastpost’) $ordersql = "  ORDER BY arc.lastpost $orderWay";
  8.     else if($orderby == ‘scores’) $ordersql = "  ORDER BY arc.scores $orderWay";
  9.     else if($orderby == ‘rand’) $ordersql = "  ORDER BY rand()";
  10.     else $ordersql = " ORDER BY arc.sortrank $orderWay";
复制代码

修改为:
  1.   //文档排序的方式
  2.     $ordersql = ”;
  3.     if($orderby==’hot’ || $orderby==’click’) $ordersql = " ORDER BY arc.click $orderWay";
  4.     else if($orderby == ‘sortrank’ || $orderby==’pubdate’) $ordersql = " ORDER BY arc.sortrank $orderWay";
  5.     else if($orderby == ‘id’) $ordersql = "  ORDER BY arc.id $orderWay";
  6.     else if($orderby == ‘near’) $ordersql = " ORDER BY ABS(arc.id – ".$arcid.")";
  7.     else if($orderby == ‘lastpost’) $ordersql = "  ORDER BY arc.lastpost $orderWay";
  8.     else if($orderby == ‘scores’) $ordersql = "  ORDER BY arc.scores $orderWay";
  9.     else if($orderby == ‘rand’) $ordersql = "  ORDER BY rand()";
  10.     else if($orderby == ‘weight’) $ordersql = "  order by arc.weight asc";//如果没有特定设置排序则按照权重先排序
  11.     else $ordersql = " ORDER BY arc.sortrank $orderWay";
复制代码

OK   现在把这个文档保存了  我们就可以在首页使用 orderby=’weight’ 进行排序了。

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

▶专业解决各类DiscuzX疑难杂症、discuz版本升级 、网站搬家 和 云服务器销售!▶有偿服务QQ 860855665 更多精品应用
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则 需要先绑定手机号

关闭

站长推荐上一条 /1 下一条

QQ|侵权投诉|广告报价|手机版|小黑屋|西部数码代理|飘仙建站论坛 ( 豫ICP备2022021143号-1 )

GMT+8, 2025-2-2 20:08 , Processed in 0.043959 second(s), 8 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表