Home> CMS Tutorial> DEDECMS> body text

How to sort dede topic node articles by id type

藏色散人
Release: 2019-12-20 10:34:39
Original
2593 people have browsed it

How to sort dede topic node articles by id type

How to sort dede topic node articles by id type?

dede topic node articles are sorted by id, click and other types

Use dedecms to create a topic, add content and find that the content titles are not sorted according to the added id , nor are they arranged in id order. It feels like random

Recommended learning:梦Weavercms

Arrange in descending order according to the id of the title.

This effect requires modifying 2 php files.

The first step:

1. Modify the includetaglibchannelspecialtopic.lib.php file

2. There is this line of code at line 52:

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

Modify to:

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

3. Save the file and end

Second step:

1. Modify includetaglibarclist.lib.php

2. About 196 Wherever you go. There is this line of code:

//文档排序的方式 $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 == 'asc') $ordersql = " order by arc.id asc"; //增加 结束 else $ordersql = " order by arc.sortrank $orderWay";
Copy after login

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 rename it to arclist.lib2.php

Then modify arclist.lib2.php

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

As for whether the imitation site is arranged in ascending or descending order,

find $orderWay = AttDef($order,'desc'); and replace it with $orderWay = AttDef($order,'asc');

If you want to call the following parameters, just click and modify

§ orderby='hot' 或 orderby='click' 表示按点击数排列 § orderby='sortrank' 或 orderby='pubdate' 按出版时间排列 § orderby='near' § orderby=='lastpost' 按最后评论时间 § orderby=='scores' 按得分排序 § orderby='id' 按文章ID排序 § orderby='rand' 随机获得指定条件的文档列表
Copy after login

For the version of dedecms 5.1

id sorting added function

include/inc/.inc_fun_SpFullList.php //文档排序的方式 $ordersql = ""; if($orderby=='rand') $ordersql = " order by rand()"; else if($orderby=='click'||$orderby=='hot') $ordersql = " order by arcf.click desc"; else if($orderby=='digg') $ordersql = " order by arcf.digg desc"; else if($orderby=='diggtime') $ordersql = " order by arcf.diggtime desc"; else $ordersql=" order by arcf.aid desc"; // 2013年针对专题id列表所加功能 if($idlist!=''){ $ordersql = " order by find_in_set(arcf.aid,'$idlist')"; }
Copy after login

The above is the detailed content of How to sort dede topic node articles by id type. 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!