Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of making the list tag of DEDECMS support weight sorting

Shulou Source: shulou.com Published: 2022-06-02 05:00:22 10月02日 Update

Editor to share with you so that DEDECMS's list tag to support weight sorting method, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

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

Let the list tag of DEDECMS support weight sorting

Recommended study: dream weaving cms

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} above is all the content of the method of making DEDECMS's list tag support weight sorting. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Sort label support document weight statement method content template article learning not much location method reason most file more column appearance Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL macOS OPPO Reno vpn Huawei