Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 282

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report