Of course! "Dede datalist" is a fundamental concept in the DedeCMS (织梦内容管理系统) ecosystem. It refers to the dede:list tag, which is the primary and most frequently used tag for displaying a list of articles, products, or any other content on your website.

Let's break it down in detail.
What is dede:list?
dede:list is a DedeCMS loop tag. This means it fetches a set of records from the database based on specific criteria and then iterates through them, displaying each record according to the HTML template you define.
It is the workhorse for creating:
- Article lists (e.g., news, blog posts)
- Product catalogs (e.g., on an e-commerce site)
- Download lists
- Image galleries
- Any paginated list of content
The Basic Syntax
The dede:list tag is used within a DedeCMS template file (.htm).
{dede:list}
<!-- HTML template for each item in the list -->
<li>
<a href="[field:arcurl/]">[field:title/]</a>
<span>[field:pubdate function="MyDate('@me')"/]</span>
</li>
{/dede:list}
How it works:
{dede:list}: This is the opening tag. It tells DedeCMS to start fetching a list of articles.- The content between the opening and closing tags is the template. This HTML structure will be repeated for each article found.
{/dede:list}: This is the closing tag, signaling the end of the list loop.
Key Attributes of dede:list
You can control the behavior of the list by adding attributes to the opening tag. Here are the most important ones:
pagesize (or row)
This attribute sets the number of items to display per page. This is crucial for pagination.
{dede:list pagesize='10'}
<!-- ... template for each item ... -->
{/dede:list}
This will display 10 articles per page.
titlelen
This attribute sets the maximum length of the article title in characters. It's useful for keeping your list layout neat and preventing long titles from breaking the design.
{dede:list titlelen='30'}
<!-- ... template for each item ... -->
{/dede:list}
```will be truncated to 30 characters, with "..." added automatically if it's cut off.
#### 3. `infolen`
Similar to `titlelen`, this sets the maximum length of the article's summary or description (often stored in the `description` or `body` field).
```html
{dede:list infolen='100'}
<!-- ... template for each item ... -->
{/dede:list}
This will show the first 100 characters of the article's summary.
orderby
This attribute controls the sort order of the articles. You can sort by various fields.
sortrank(default): Sorts by manual ordering. You can set this order when editing an article.pubdate: Sorts by publication date (newest first).senddate: Sorts by the date the article was added to the database.hotorclick: Sorts by the number of views (clicks).
{dede:list orderby='pubdate' pagesize='15'}
<!-- ... template for each item ... -->
{/dede:list}
This displays the 15 newest articles.
orderway
This specifies the sort direction: desc for descending (newest, highest) or asc for ascending (oldest, lowest). It usually works with orderby.
{dede:list orderby='click' orderway='desc' pagesize='10'}
<!-- ... template for each item ... -->
{/dede:list}
This displays the 10 most-viewed articles.
typeid
This is one of the most powerful attributes. It filters the list to show only articles from a specific category (channel). You must use the ID of the category.
{dede:list typeid='5' pagesize='8'}
<!-- ... template for each item ... -->
{/dede:list}
This will display 8 articles from the category with ID 5.
channelid
This is similar to typeid but is used for channels (main content types like articles, products, downloads). If you are listing articles, channelid is usually not needed as it defaults to articles.
Using Field Variables ([field:xxx/])
Inside the {dede:list} loop, you use special field variables to display the content of each article. The variable name is prefixed with field:.
| Field Variable | Description |
|---|---|
[field:id/] |
The unique ID of the article. |
[field:title/] |
The title of the article. |
[field:arcurl/] |
The full URL to the article's detail page. This is the most important one for links. |
[field:pubdate/] |
The publication date. It's a timestamp, so you often use a function to format it. |
[field:description/] |
The article's summary/description. |
[field:litpic/] |
The URL of the article's thumbnail or cover image. |
[field:click/] |
The number of times the article has been viewed. |
[field:typeid/] |
The ID of the category the article belongs to. |
Formatting Dates with Functions:
The pubdate field is a Unix timestamp. To display it in a readable format, you use the function parameter.
[field:pubdate function='strftime("%Y-%m-%d", @me)'/]
This would display the date as 2025-10-27.
You can also use a custom PHP function defined in your DedeCMS configuration. A common one is MyDate.
[field:pubdate function="MyDate('Y-m-d', @me)"/]
Putting It All Together: A Complete Example
Let's create a common scenario: a "Latest News" section on a homepage that shows the 5 most recent articles from the "News" category (let's say its ID is 3).
Template File (index.htm)
<div class="news-list">
<h2>Latest News</h2>
<ul>
{dede:list typeid='3' pagesize='5' orderby='pubdate' orderway='desc'}
<li>
<div class="news-thumb">
<a href="[field:arcurl/]">
<img src="[field:litpic/]" alt="[field:title/]" />
</a>
</div>
<div class="news-content">
<h3><a href="[field:arcurl/]">[field:title/]</a></h3>
<p class="news-summary">[field:description function='cn_substr(@me, 100)'/]...</p>
<span class="news-date">[field:pubdate function="MyDate('Y-m-d', @me)"/]</span>
</div>
</li>
{/dede:list}
</ul>
<!-- This is where the pagination links will be automatically generated -->
<div class="dede_pages">
<ul class="pagelist">
{dede:pagelist listsize='4'/}
</ul>
</div>
</div>
Explanation:
{dede:list typeid='3' ...}: Fetches articles only from category ID 3.pagesize='5': Shows 5 articles per page.orderby='pubdate' orderway='desc': Sorts by the newest date first.[field:litpic/]: Displays the thumbnail image.[field:arcurl/]: Creates a link to the full article.[field:title/]: Displays the article title.[field:description ...]: Shows a 100-character summary of the description.{dede:pagelist ...}: This is another essential tag that automatically generates the "Page 1, 2, 3, Next..." links based on thepagesizeyou set.
Important Considerations
- Channel Templates: The
dede:listtag is used in list templates (e.g.,list_article.htm). You need to assign this template to your channel in the DedeCMS backend (Channels -> Content Management). - Performance: For very large websites with thousands of articles, complex
dede:listqueries can be slow. Using propertypeidandorderbyattributes helps the database perform better. - DedeCMS Version: While the core functionality of
dede:listis consistent, some advanced attributes or field variables might differ slightly between DedeCMS versions (like the older 5.7 vs. newer versions). Always refer to the documentation for your specific version.
