GetAtt('weight')"; then modify the document sorting method; finally Save this file to sort the home page by weight."> How to sort DEDE 5.7 home page by weight-DEDECMS-php.cn
Home> CMS Tutorial> DEDECMS> body text

How to sort DEDE 5.7 home page by weight

藏色散人
Release: 2019-11-15 11:14:49
Original
1817 people have browsed it

How to sort DEDE 5.7 home page by weight

DEDE 5.7 How to sort the homepage by weight?

DEDE 5.7 Homepage [arclist] Add by weight Sorting

1. Find the arclist.lib.php file in the following directory \include\taglib in the DreamWeaver system and open it

Found around lines 74 and 75:

Recommended learning:dedecms tutorial

// arclist是否需要weight排序,默认为"N",如果需要排序则设置为"Y" $isweight = $ctag->GetAtt('isweight');
Copy after login

Modify this line to:

$weight = $ctag->GetAtt('weight');
Copy after login

Found around line 327

//文档排序的方式 $ordersql = ''; if($orderby=='hot' || $orderby=='click') $ordersql = " ORDER BY arc.click $orderWay"; else if($orderby == 'sortrank' || $orderby=='pubdate') $ordersql = " ORDER BY arc.sortrank $orderWay"; else if($orderby == 'id') $ordersql = " ORDER BY arc.id $orderWay"; else if($orderby == 'near') $ordersql = " ORDER BY ABS(arc.id - ".$arcid.")"; else if($orderby == 'lastpost') $ordersql = " ORDER BY arc.lastpost $orderWay"; else if($orderby == 'scores') $ordersql = " ORDER BY arc.scores $orderWay"; else if($orderby == 'rand') $ordersql = " ORDER BY rand()"; else $ordersql = " ORDER BY arc.sortrank $orderWay";
Copy after login

and modify it to:

//文档排序的方式 $ordersql = ''; if($orderby=='hot' || $orderby=='click') $ordersql = " ORDER BY arc.click $orderWay"; else if($orderby == 'sortrank' || $orderby=='pubdate') $ordersql = " ORDER BY arc.sortrank $orderWay"; else if($orderby == 'id') $ordersql = " ORDER BY arc.id $orderWay"; else if($orderby == 'near') $ordersql = " ORDER BY ABS(arc.id - ".$arcid.")"; else if($orderby == 'lastpost') $ordersql = " ORDER BY arc.lastpost $orderWay"; else if($orderby == 'scores') $ordersql = " ORDER BY arc.scores $orderWay"; else if($orderby == 'rand') $ordersql = " ORDER BY rand()"; else if($orderby == 'weight') $ordersql = " order by arc.weight $orderWay";//如果没有特定设置排序则按照权重先排序 else $ordersql = " ORDER BY arc.sortrank $orderWay";
Copy after login

OK Now save this document, we can use orderby='weight' to sort on the home page.

The above is the detailed content of How to sort DEDE 5.7 home page by weight. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!