全网整合营销服务商

电脑端+手机端+微信端=数据同步管理

技术支持电话:139-6697-2999

织梦文章按照权重进行排序的方法

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

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

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

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

#p#分页标题#e#01 {dede:arclist  orderby='weight' isweight='y' row='14'#p#分页标题#e#   titlelen='48'  typeid='9'}
#p#分页标题#e#02     <li>
03#p#分页标题#e#        <span class="title f_l">
04#p#分页标题#e#            <a href="[field:filename/]" title="[field:title/]">
#p#分页标题#e# 05                [field:array runphp='yes'if#p#分页标题#e# (@me['shorttitle']=='') @me=@me['title'];#p#分页标题#e#else @me=@me['shorttitle'];[/field:array]
06#p#分页标题#e#             </a>
07        #p#分页标题#e#</span>
08        <span class="pubdate f_r"#p#分页标题#e#>
09            [field:pubdate #p#分页标题#e#function=MyDate('Y-m-d',@me)/]
10#p#分页标题#e#        </span>
11     #p#分页标题#e#</li>
12 {/dede:arclist}

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

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

#p#分页标题#e#
1 {dede:list   pagesize='12'    orderby=#p#分页标题#e#'weight'   orderway='asc'}

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

#p#分页标题#e#
1 else if($orderby==#p#分页标题#e#"lastpost") {
2         $ordersql = #p#分页标题#e#"  ORDER BY arc.lastpost $orderWay";
3 }#p#分页标题#e#

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

1#p#分页标题#e# else if($orderby=="weight") {
#p#分页标题#e#2              $ordersql = " order by arc.weight $orderWay";
#p#分页标题#e# 3 }

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

#p#分页标题#e# 1 preg_match('/hot|click|lastpost/', $orderby)

把它修改为:

#p#分页标题#e#
1 preg_match('/weight|hot|click|lastpost/', $orderby)#p#分页标题#e#

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

您的项目需求

*请认真填写需求信息,我们会在24小时内与您取得联系。