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='[field:typeurl/]' [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!