Of course! "Dede lastpost" is a very common term among users of the DedeCMS (also known as Dedecms) content management system. It refers to a specific PHP tag used to display a list of the latest articles or posts on a website.

Let's break it down in detail.
What is "Dede Lastpost"?
In simple terms, "Dede Lastpost" is a DedeCMS template tag ({dede:arclist}) configured to show the most recently published articles. It's not a separate function but rather a specific use of the powerful arclist (article list) tag.
You will use this tag in your DedeCMS template files (.htm) to create sections like:
- "Latest News"
- "Recent Articles"
- "Newly Published"
- "Recently Updated"
The Core Tag: {dede:arclist}
The tag responsible for displaying lists of articles is {dede:arclist}. To make it show the "last posts," you use specific attributes to control its behavior.

Basic Syntax:
{dede:arclist
typeid='0' len='30'
row='10'
orderby='pubdate'
orderway='desc'
}
<a href='[field:arcurl/]'>[field:title/]</a>
<span>[field:pubdate function="MyDate('Y-m-d',@me)"/]</span>
{/dede:arclist}
Key Attributes for "Lastpost"
Here are the most important attributes you'll use to configure your "lastpost" list:
| Attribute | Value | Description | Example |
|---|---|---|---|
typeid |
0 or Category ID |
Specifies which category's articles to show. 0 means all categories. |
typeid='5' (show from category with ID 5) |
row |
Number | The number of articles to display. | row='8' (show 8 latest articles) |
orderby |
pubdate, id, click |
The field to sort the articles by. For "lastpost", pubdate is essential. |
orderby='pubdate' (sort by publication date) |
orderway |
desc, asc |
The sort order. desc for descending (newest first), asc for ascending. |
orderway='desc' (newest articles on top) |
subday |
Number | Show articles published within the last N days. | subday='7' (show articles from the last 7 days) |
Practical Examples
Here are some common examples of how you would use the "Dede Lastpost" tag.
Example 1: Simple Latest Posts List
This code displays the 10 most recent articles from all categories, with a 30-character limit on the title.
<h3>Latest Articles</h3>
<ul>
{dede:arclist row='10' titlelen='30' orderby='pubdate' orderway='desc'}
<li>
<a href="[field:arcurl/]" title="[field:title/]">[field:title/]</a>
<span class="date">([field:pubdate function="MyDate('m-d',@me)"/])</span>
</li>
{/dede:arclist}
</ul>
Example 2: Latest Posts from a Specific Category
To show only the latest posts from a specific category (e.g., Category ID = 3), use the typeid attribute.
<h3>Latest News</h3>
<ul>
{dede:arclist typeid='3' row='5' titlelen='40' orderby='pubdate' orderway='desc'}
<li>
<a href="[field:arcurl/]">[field:title/]</a>
</li>
{/dede:arclist}
</ul>
Example 3: Latest Posts with Thumbnail (Litpic)
This is a very popular use case, showing the latest posts along with their featured images.
<div class="latest-posts">
{dede:arclist row='4' titlelen='28' orderby='pubdate' orderway='desc'}
<div class="post-item">
<a href="[field:arcurl/]">
<img src="[field:litpic/]" alt="[field:title/]" />
</a>
<h4><a href="[field:arcurl/]">[field:title/]</a></h4>
<p class="date">[field:pubdate function="MyDate('Y-m-d',@me)"/]</p>
</div>
{/dede:arclist}
</div>
Common Field Variables (Placeholders)
Inside the {dede:arclist} tag, you use placeholders to display specific information about each article.
| Variable | Description |
|---|---|
[field:title/] |
The article's title. |
[field:arcurl/] |
The full URL to the article. |
[field:litpic/] |
The URL of the article's thumbnail/featured image. |
[field:pubdate/] |
The publication date (timestamp format). You almost always need to format it. |
[field:description/] |
The article's summary/description. |
[field:click/] |
The number of clicks/views the article has received. |
Formatting the Date
The pubdate field returns a timestamp (e.g., 1712345678). To display it in a human-readable format, you use the function parameter.
<!-- Display date as YYYY-MM-DD -->
[field:pubdate function="MyDate('Y-m-d',@me)"/]
<!-- Display date as Month Day, Year -->
[field:pubdate function="MyDate('F j, Y',@me)"/]
<!-- Display a relative time (e.g., "2 days ago") - requires custom JS -->
[field:pubdate function="GetTime(@me)"/]
Troubleshooting Common Issues
-
"No articles are showing!"
- Cause 1: The
typeidmight be pointing to an empty category or a category that doesn't exist. - Cause 2: The
rowvalue might be0. - Solution: Set
typeid='0'to pull from all categories and make surerowis a positive number.
- Cause 1: The
-
The list is showing old articles, not the latest.
- Cause: The
orderbyororderwayattributes are incorrect. - Solution: Ensure you have
orderby='pubdate'andorderway='desc'.
- Cause: The
-
The titles are too long and break the layout.
- Cause: The
titlelenvalue is too large. - Solution: Decrease the
titlelenvalue (e.g., from50to30).
- Cause: The
Summary
To create a "Dede Lastpost" section, you need to:
- Use the
{dede:arclist}tag in your template file (e.g.,index.htm). - Set the key attributes:
row: How many posts to show.orderby='pubdate': Sort by publication date.orderway='desc': Newest posts first.typeid: (Optional) Limit to a specific category.
- Use field variables like
[field:title/]and[field:arcurl/]to display the article information. - Format the date using
function="MyDate('format',@me)".
