織夢文章按照權重進行排序的方法
發表時間:2020-01-04 21:38 瀏覽次數:
說到了織夢文章排列順序的幾種方法,其他的沒問題,但是第一種按照文章的權重進行排序,在具體操作的時候,很多站長遇到了問題,下面我來統一解答下。
織夢文章按照權重進行排序的操作步驟:
一、首頁文章按照權重排序
把 orderby='weight' isweight='y' 加到對應的標簽中即可。
01 {dede:arclist orderby='weight' isweight='y' row='14' titlelen='48' typeid='9'}
02 <li>
03 <span class="title f_l">
04 <a href="[field:filename/]" title="[field:title/]">
05 [field:array runphp='yes'] if (@me['shorttitle']=='') @me=@me['title'];else @me=@me['shorttitle'];[/field:array]
06 </a>
07 </span>
08 <span class="pubdate f_r">
09 [field:pubdate function=MyDate('Y-m-d',@me)/]
10 </span>
11 </li>
12 {/dede:arclist}
二、欄目頁文章按照權重排序
第一步:打開欄目頁模版list_article.htm,在修改{dede:list}標簽中的代碼為:
1 {dede:list pagesize='12' orderby='weight' orderway='asc'}
第二步:通過路徑找到/include/arc.listview.class.php這個文件并打開,在大約735行左右找到下面這段代碼:
1 else if($orderby=="lastpost") {
2 $ordersql = " ORDER BY arc.lastpost $orderWay";
3 }
在這段代碼的后邊加入以下代碼:
1 else if($orderby=="weight") {
2 $ordersql = " order by arc.weight $orderWay";
3 }
第三步:還是在這個文件中,在大約775行的位置找到:
1 preg_match('/hot|click|lastpost/', $orderby)
把它修改為:
1 preg_match('/weight|hot|click|lastpost/', $orderby)
好,保存之后,更新后臺,刷新頁面即可!
織夢文章按照權重進行排序的操作步驟:
一、首頁文章按照權重排序
把 orderby='weight' isweight='y' 加到對應的標簽中即可。
01 {dede:arclist orderby='weight' isweight='y' row='14' titlelen='48' typeid='9'}
02 <li>
03 <span class="title f_l">
04 <a href="[field:filename/]" title="[field:title/]">
05 [field:array runphp='yes'] if (@me['shorttitle']=='') @me=@me['title'];else @me=@me['shorttitle'];[/field:array]
06 </a>
07 </span>
08 <span class="pubdate f_r">
09 [field:pubdate function=MyDate('Y-m-d',@me)/]
10 </span>
11 </li>
12 {/dede:arclist}
二、欄目頁文章按照權重排序
第一步:打開欄目頁模版list_article.htm,在修改{dede:list}標簽中的代碼為:
1 {dede:list pagesize='12' orderby='weight' orderway='asc'}
第二步:通過路徑找到/include/arc.listview.class.php這個文件并打開,在大約735行左右找到下面這段代碼:
1 else if($orderby=="lastpost") {
2 $ordersql = " ORDER BY arc.lastpost $orderWay";
3 }
在這段代碼的后邊加入以下代碼:
1 else if($orderby=="weight") {
2 $ordersql = " order by arc.weight $orderWay";
3 }
第三步:還是在這個文件中,在大約775行的位置找到:
1 preg_match('/hot|click|lastpost/', $orderby)
把它修改為:
1 preg_match('/weight|hot|click|lastpost/', $orderby)
好,保存之后,更新后臺,刷新頁面即可!
上一篇:dede編輯文章更新發布時間的方法 下一篇:影響網站建設空間費用的因素有哪些