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

The method of sorting articles on dede Special Node by id Type

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces the method of sorting dede special node articles according to id type, which is very detailed and has certain reference value. Friends who are interested must finish it!

How are dede feature node articles sorted by id type?

Dede feature node articles are sorted by id, click, etc.

Use dedecms to create a theme, and add content to find that the content titles are not sorted by the added id, nor are they sorted by id. It feels like random.

Sort by id descending order of the title.

This effect requires 2 php files to be modified.

The first step:

1. Modify the includetaglibchannelspecialtopic.lib.php file

two。 There is this line of code at line 52:

$ctag- > GetAtt ('imgwidth'), $ctag- > GetAtt (' imgheight'), 'all',' default', $keywords, $listTemplet, 0, $idlist

Modified to:

$ctag- > GetAtt ('imgwidth'), $ctag- > GetAtt (' imgheight'), 'all',' asc', $keywords, $listTemplet, 0, $idlist

3. End of saving file

Step 2:

1. Modify includetaglibarclist.lib.php

two。 It's about 196 lines. There is this line of code:

/ / how documents are sorted $ordersql =''; if ($orderby=='hot' | | $orderby=='click') $ordersql = "orderby arc.click $orderWay"; else if ($orderby==' sortrank' | | $orderby=='pubdate') $ordersql = "orderby arc.sortrank $orderWay"; else if ($orderby==' id') $ordersql = "orderby arc.id $orderWay"; else if ($orderby==' near') $ordersql = "orderby ABS (arc.id -". $arcid. ")" Else if ($orderby = = 'lastpost') $ordersql = "orderby arc.lastpost $orderWay"; else if ($orderby = =' scores') $ordersql = "orderby arc.scores $orderWay"; else if ($orderby = = 'rand') $ordersql = "orderby rand ()"; / / add start else if ($orderby = =' asc') $ordersql = "orderby arc.id asc"; / / add end else $ordersql = "orderby arc.sortrank $orderWay"

3. End of modification

Here is another implementation method

1. Find include/taglib//channel/specialtopic.lib.php

2. Replace require_once (DEDEINC.'/taglib/arclist.lib.php') with require_once (DEDEINC.'/taglib/arclist.lib2.php')

3. Copy arclist.lib.php and change its name to arclist.lib2.php.

Then modify the arclist.lib2.php

Find $order='desc' and replace $orderby='id'

You only need to imitate the station about whether it is in ascending or descending order.

Find $orderWay = AttDef ($order,'desc'); replace with $orderWay = AttDef ($order,'asc')

To call the following parameters, you just need to modify them.

§orderby='hot' or orderby='click' means to arrange by clicks §orderby='sortrank' or orderby='pubdate' by publishing time §orderby='near' orderby=='lastpost' by last comment time §orderby=='scores' sort by score orderby='id' sort by article ID sort §orderby='rand' randomly get a list of documents with specified criteria

For the version of dedecms 5.1

Id sorting added features more

Include/inc/.inc_fun_SpFullList.php// documents are sorted by $ordersql= ""; if ($orderby=='rand') $ordersql= "orderby rand ()"; else if ($orderby=='click' | | $orderby=='hot') $ordersql= "orderby arcf.click desc"; else if ($orderby=='digg') $ordersql= "orderby arcf.digg desc"; else if ($orderby=='diggtime') $ordersql= "orderby arcf.diggtime desc"; else $ordersql= "orderby arcf.aid desc" / / in 2013, the function if ($idlistlists ordered posts') {$ordersql = "order by find_in_set (arcf.aid,'$idlist')" was added to the id list of topics.} above is all the contents of the method of sorting dede feature node articles by id type. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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: 0

*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