【dedecms织梦教程】第二十九节:织梦文章按照权重进行排序的方法

上一节说到了织梦文章排列顺序的几种方法,其他的没问题,但是第一种按照文章的权重进行排序,在具体操作的时候,很多站长遇到了问题,下面我来统一解答下。

织梦文章按照权重进行排序的操作步骤:

一、首页文章按照权重排序

把 orderby='weight' ISweight='y' 加到对应的标签中即可。

{dede:arclist orderby='weight' isweight='y' row='14' titlelen='48' typeid='9'} <li> <span class="title f_l"> <a href="[field:filename/]" title="[field:title/]"> [field:array runphp='yes'] if (@me['shorttitle']=='') @me=@me['title'];else @me=@me['shorttitle'];[/field:array] </a> </span> <span class="pubdate f_r"> [field:pubdate function=MyDate('Y-m-d',@me)/] </span> </li> {/dede:arclist}

二、栏目页文章按照权重排序

第一步:打开栏目页模版list_article.htm,在修改{dede:list}标签中的代码为:

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

第二步:通过路径找到/include/arc.listview.class.php这个文件并打开,在大约735行左右找到下面这段代码:

else if($orderby=="lastpost") { $ordersql = " ORDER BY arc.lastpost $orderWay"; }

在这段代码的后边加入以下代码:

else if($orderby=="weight") { $ordersql = " order by arc.weight $orderWay"; }

第三步:还是在这个文件中,在大约775行的位置找到:

preg_match('/hot|click|lastpost/', $orderby)

把它修改为:

preg_match('/weight|hot|click|lastpost/', $orderby)

好,保存之后,更新后台,刷新页面即可!

dede模板
织梦免费模板
免费模板下载
网站源码
织梦模板
Flash网站模板

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容