SetQuery()"; then use the dede tag to call the ID in the foreground."/> SetQuery()"; then use the dede tag to call the ID in the foreground.">

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

How dede sorts by ID

藏色散人
藏色散人Original
2019-12-10 10:25:022964browse

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");

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");

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}

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!

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