Of course! In the DedeCMS (织梦CMS) content management system, orderby desc is a fundamental and very common parameter used within the {dede:arclist} and {dede:sql} tags to control the sort order of your content.

Let's break it down in detail.
What is orderby?
orderby is an attribute of the {dede:arclist} tag (used for listing articles from the database) and the {dede:sql} tag (used for executing custom SQL queries). Its purpose is to define which field in the database table should be used for sorting the results.
What is desc?
desc is a SQL keyword that stands for "Descending". When used in an ORDER BY clause, it sorts the results from the highest value to the lowest.
The opposite is asc (for "Ascending"), which sorts from the lowest value to the highest. If you don't specify asc or desc, the default is usually asc.

How to Use orderby desc in Practice
Here are the most common use cases.
Case 1: Listing Latest Articles (Most Common)
This is the most frequent use case. You want to show the newest articles at the top of the list. To do this, you sort by the id field (which is usually auto-incremented) or the pubdate field (publication date).
Using orderby=id:
Since new articles have a higher id than old ones, sorting by id in descending order effectively puts the newest articles first.
{dede:arclist titlelen='30' row='10' orderby='id' typeid=''}
<li>
<a href='[field:arcurl/]'>[field:title/]</a>
<span>[field:pubdate function="MyDate('Y-m-d',@me)"/]</span>
</li>
{/dede:arclist}
Using orderby=pubdate:
This is more precise, as it sorts by the actual date and time the article was published.

{dede:arclist titlelen='30' row='10' orderby='pubdate' typeid=''}
<li>
<a href='[field:arcurl/]'>[field:title/]</a>
<span>[field:pubdate function="MyDate('Y-m-d',@me)"/]</span>
</li>
{/dede:arclist}
Case 2: Listing Most Popular Articles
If you have a click counter (click field) on your articles, you can list them from most viewed to least viewed.
{dede:arclist titlelen='30' row='10' orderby='click' typeid=''}
<li>
<a href='[field:arcurl/]'>[field:title/]</a>
<span>Views: [field:click/]</span>
</li>
{/dede:arclist}
Case 3: Listing Articles by Last Updated Time
If you want to show articles that were most recently modified, you can sort by the uptime field.
{dede:arclist titlelen='30' row='10' orderby='uptime' typeid=''}
<li>
<a href='[field:arcurl/]'>[field:title/]</a>
<span>Last Updated: [field:pubdate function="MyDate('Y-m-d',@me)"/]</span>
</li>
{/dede:arclist}
Case 4: Using with {dede:sql}
The orderby attribute works exactly the same way in {dede:sql}. This is useful for complex queries not possible with arclist.
Example: Get the 5 most recent articles from a specific channel.
(Note: dede_archives is the main article table, and channel is the channel ID)
{dede:sql sql="SELECT id, title, pubdate FROM dede_archives WHERE channel=1 ORDER BY pubdate DESC LIMIT 0,5"}
<li>
<a href='/plus/view.php?aid=[field:id/]'>[field:title/]</a>
<span>[field:pubdate function="MyDate('Y-m-d',@me)"/]</span>
</li>
{/dede:sql}
Notice that in the SQL query itself, we use ORDER BY pubdate DESC. The orderby='pubdate desc' attribute in the tag is just a shortcut for this.
Common orderby Options for {dede:arclist}
Here is a list of the most common fields you can use for the orderby parameter:
orderby Value |
Description | Example Use Case |
|---|---|---|
id |
Sorts by the article's unique ID. | orderby='id' |
sortrank |
Sorts by the manual sort order set in the backend. | orderby='sortrank' |
pubdate |
Sorts by the publication date. | orderby='pubdate' |
senddate |
Sorts by the submission date. | orderby='senddate' |
click |
Sorts by the click count (views). | orderby='click' |
hot |
Sorts by a "heat" value. | orderby='hot' |
lastpost |
Sorts by the time of the last comment. | orderby='lastpost' |
rand |
Random order. (Does not use asc or desc) |
orderby='rand' |
near |
Sorts by proximity to the current date/time. | orderby='near' |
Combining orderby with Other Attributes
You can often combine orderby with other attributes to get the exact list you need.
typeid: To limit the list to a specific category.row: To set the number of results to display.channel: To limit to a specific channel type (e.g., articles, downloads).
Example: Get the 10 most viewed articles from category 5.
{dede:arclist row='10' typeid='5' orderby='click' desc=''}
<a href='[field:arcurl/]'>[field:title/]</a>
{/dede:arclist}
Note: In some older or specific DedeCMS versions, you might see desc='' as a separate attribute instead of being appended to orderby. However, orderby='click desc' is the more modern and standard syntax.
Summary
| Component | Meaning | Example |
|---|---|---|
orderby |
The field to sort by. | orderby='pubdate' |
desc |
The sort order (Descending). | orderby='pubdate desc' |
asc |
The sort order (Ascending). | orderby='pubdate asc' |
In short, when you see orderby desc in a DedeCMS template, it means: "Sort these results based on the specified field, with the highest values appearing first." It's the key to displaying your latest, most popular, or most recently updated content.
