Home > CMS Tutorial > DEDECMS > How dede sorts by ID

How dede sorts by ID

藏色散人
Release: 2019-12-10 10:25:02
Original
2905 people have browsed it

How dede sorts by ID

dedeHow to sort by ID?

dede sorting problem: How to sort by the ID you wrote and change the function. It can be easily implemented. There is a specific example below. You can refer to the following

Recommended learning: 梦Weavercms

Change the function and implement the sorting method according to your own writing Sort by ID just fine.

Method:

1. Open include/taglib/channelartlist.lib.php, find about 78 lines, and modify the

code as follows:

$dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE $tpsql ORDER BY sortrank ASC LIMIT $totalnum");
Copy after login

For:

The code is as follows:

$dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE $tpsql ORDER BY substring_index('$typeid',id,1) LIMIT $totalnum");
Copy after login

2. Front desk call tag:

The code is as follows:

{dede:channelartlist typeid='1,2,3,4,5,6'} 
{dede:type} 
<li><a href=&#39;[field:typeurl/]&#39; [field:rel/]>[field:typename/]</a></li> 
{/dede:type} 
{/dede:channelartlist}
Copy after login

Sort according to the ID of the column, what do you want? Just change the order of IDs,

The above is the detailed content of How dede sorts by ID. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template