Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the way to make the list tag of DEDECMS support weight sorting

Shulou Source: shulou.com Published: 2022-06-02 04:37:24 09月29日 Update

This article will explain in detail what the method of letting DEDECMS's list tag support weight sorting is, the editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

How to make the list tag of DEDECMS support weight sorting?

The DEDECMS system supports document weight weight sorting, which can be used in templates:

{dede:arclist row='10' titlelen='50' orderby='weight'} [field:textlink/] {/ dede:arclist}

Among them, orderby='weight' realizes that documents are sorted by weight. This is the arclist tag and can be used anywhere to call the document list.

However, on the column list page, if you want to use the list tag (to paginate the document list), you also want to sort it with weight

{dede:list pagesize='10' titlelen='50' orderby='weight'} [field:textlink/] {/ dede:list}

You will find that your list is not sorted by weight (weight), no matter how you modify it, its order is still the same!

Reason: dedecms supports weighted weight sorting only arclist tags, not list tags

Solution:

1. Open the file arc.listview.class.php

2. Look for the "else if ($orderby==" lastpost ") {" statement, which is about 609 lines. Press enter before this line and insert the following statement:

Else if ($orderby== "weight") {$ordersql = "orderby arc.weight $orderWay";}

3. Continue to find the "if ('hot | click | lastpost',$orderby)" statement and modify it to:

If (ereg ('hot | click | weight | lastpost',$orderby))

After the modification is completed, save it. If weight sorting has been used in the target, generate it, and you can see that weight sorting has been installed in the document list.

4. Template call

{dede:arclist row='10' titlelen='50' orderby='weight'} [field:textlink/] {/ dede:arclist} this is the way to make DEDECMS's list tags support weight sorting. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

Tags: Sorting tags support documents weights statements methods more templates articles good practical location content methods reasons files articles columns appearance Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Huawei Apple Redmi NVidia