Of course! The dede:arclist tag is one of the most frequently used tags in DedeCMS. The pagesize attribute is essential for controlling how many articles are displayed on a page.

Here's a complete guide on how to use pagesize in dede:arclist.
What is pagesize?
The pagesize attribute in the dede:arclist tag specifies the maximum number of articles to display on a single page.
- Purpose: To limit the output, preventing a single page from becoming too long and to enable pagination.
- Default Value: If you don't set
pagesize, DedeCMS uses its default setting, which is typically 10 articles per page. It's best practice to always define it explicitly.
Basic Syntax
The attribute is added directly inside the dede:arclist tag.
{dede:arclist pagesize='20' ...}
<!-- Article template code here -->
<li>
<a href="[field:arcurl/]">[field:title/]</a>
<span>[field:pubdate function="MyDate('@me', 'Y-m-d')"/]</span>
</li>
{/dede:arclist}
In this example, the list will display a maximum of 20 articles.

Practical Examples
Example 1: Displaying 5 Articles in the Homepage Sidebar
This is a common use case for a "Latest News" widget in a sidebar.
<h3>Latest News</h3>
<ul class="sidebar-news">
{dede:arclist pagesize='5' titlelen='30' orderby='pubdate'}
<li>
<a href="[field:arcurl/]" title="[field:title/]">[field:title function='cn_substr(@me, 30)'/]</a>
</li>
{/dede:arclist}
</ul>
pagesize='5': Shows only 5 articles.len='30'`: Limits the title length to 30 characters.orderby='pubdate': Orders articles by their publication date, newest first.
Example 2: Creating an Article List Page with Pagination
When you use pagesize, DedeCMS automatically generates the necessary pagination links (< Previous 1 2 3 Next >) at the end of the list, provided you have the pagination template tag in your HTML.
Template File (e.g., list_article.htm)
<!DOCTYPE html>
<html>
<head>{dede:field.title/} - {dede:global.cfg_webname/}</title>
</head>
<body>
<h1>{dede:field.title/}</h1>
<!-- The article list using pagesize -->
<ul class="article-list">
{dede:arclist pagesize='15' titlelen='50' orderby='pubdate'}
<li>
<a href="[field:arcurl/]" title="[field:title/]">[field:title/]</a>
<p class="summary">[field:description function='cn_substr(@me, 150)'/]...</p>
<span class="date">[field:pubdate function="MyDate('@me', 'Y-m-d')"/]</span>
</li>
{/dede:arclist}
</ul>
<!-- THIS IS THE KEY FOR PAGINATION -->
<div class="page-nav">
{dede:pagelist listsize='5' listitem='pre,next,pageno'}
</div>
</div>
</body>
</html>
pagesize='15': Each page will show 15 articles.{dede:pagelist ...}: This is the tag that renders the pagination links. It works in conjunction withpagesize.listsize='5': Shows 5 page numbers in the list (e.g.,... 5 6 7 8 9 ...).listitem='pre,next,pageno': Specifies which items to display: Previous link, Next link, and Page Numbers.
Troubleshooting Common Issues
Issue 1: Pagination Links Don't Appear
Problem: You set pagesize, but you don't see the "Previous 1 2 3 Next" links.
Solution: You are missing the {dede:pagelist} tag in your template file. Make sure you add it after the {/dede:arclist} closing tag.
Issue 2: Pagination Links Are Broken (404 Error)
Problem: The pagination links are there, but clicking on them gives a "Page Not Found" error.
Solution: This is almost always a problem with your URL or rewrite rules.
- Check your URL settings in DedeCMS backend:
- Go to "System" -> "System Basic Parameters" -> "Core Settings".
- Look for "Article Path Setting". It should be set to something like
/{typedir}/{Y}/{M}/{D}/{aid}.htmlor/{typedir}/{aid}.html.
- Check your
.htaccessfile (if using Apache mod_rewrite):- Ensure the rewrite rules for pagination are correct. The default DedeCMS
.htaccessusually handles this automatically, but if you've modified it, you might have broken the pagination logic. A common rule looks like this:RewriteRule ^list-([0-9]+)-([0-9]+)\.html$ /plus/list.php?tid=$1&PageNo=$2
- The key is the
PageNo=$2part, which tells DedeCMS which page number is being requested.
- Ensure the rewrite rules for pagination are correct. The default DedeCMS
Important Related Attributes
pagesize works best when combined with other attributes for precise control.
| Attribute | Description | Example |
|---|---|---|
typeid |
Limits articles to a specific category or list of categories. | typeid='5,8,12' |
channelid |
Limits articles to a specific content model (e.g., articles, downloads). | channelid='1' (for articles) |
orderby |
Sorts the articles. Common values: pubdate (date), hot (clicks), sortrank (manual order). |
orderby='hot' |
orderway |
Sets the sort order: desc (descending) or asc (ascending). |
orderway='desc' |
infolen |
The length of the article summary (description). | infolen='200' |
Summary
To use pagesize effectively:
- Add
pagesize='N'to yourdede:arclisttag, whereNis the number of articles per page. - Add
{dede:pagelist ...}to your template to display the pagination links. - Check your URL and
.htaccesssettings if pagination links result in a 404 error.
