Of course! The typeid parameter in DedeCMS (织梦CMS) is one of the most fundamental and frequently used parameters, especially within its template engine ({dede:} tags). It's the key to organizing and displaying your website's content structure.

Here’s a complete breakdown of what typeid is, how it works, and how to use it effectively.
What is typeid?
In simple terms, typeid is the ID number of a specific channel (栏目) in your DedeCMS website.
- Channel (栏目): This is your website's content structure. Think of it as folders or categories on your computer. For example, you might have channels named "News," "Products," "Downloads," and "About Us."
- ID (标识符): Each channel is assigned a unique numeric ID automatically when you create it in the DedeCMS backend (后台).
The typeid parameter tells a DedeCMS tag which channel's content it should fetch or operate on.
Where is typeid Used?
You will primarily use typeid inside DedeCMS's built-in template tags ({dede:...}). Here are the most common use cases:

a) {dede:arclist} - Article List Tag
This is the most common use case. You use typeid to display a list of articles from a specific channel.
Purpose: To show a list of articles (文章) belonging to a certain channel and its sub-channels.
Syntax:
{dede:arclist typeid='1' titlelen='30' row='10'}
<li>
<a href="[field:arcurl/]">[field:title/]</a>
<span>[field:pubdate function="MyDate('Y-m-d',@me)"/]</span>
</li>
{/dede:arclist}
Parameters Explained:

typeid='1': This is the key parameter. It tells the tag to get articles from the channel with ID1. If you want articles from a channel and all its sub-channels, you just provide the top-level channel's ID.len='30'`: Limits the title length to 30 characters.row='10': Displays 10 articles.
Example:
If you have a channel "News" with ID 3 and a sub-channel "Tech News" with ID 5, setting typeid='3' will display articles from both "News" and "Tech News".
b) {dede:channel} - Channel List Tag
This tag is used to display a list of channels (栏目导航).
Purpose: To create a navigation menu or a list of sub-channels.
Syntax:
{dede:channel typeid='2' type='son' currentstyle="<li class='thisclass'><a href='~typelink~'>~typename~</a></li>"}
<li><a href="[field:typelink/]">[field:typename/]</a></li>
{/dede:channel}
Parameters Explained:
typeid='2': Specifies the parent channel whose sub-channels you want to list. Iftypeidis not set, it lists all top-level channels.type='son': Tells the tag to list only the direct sub-channels of the channel specified intypeid. Other values includeself(only the channel itself) andtop(all top-level channels).currentstyle: Allows you to apply special CSS styling to the channel that is currently being viewed.
c) {dede:field} - Field Tag
This tag is used to display a specific field of the current channel.
Purpose: To get information about the channel you are currently on, such as its name, description, or SEO title.
Syntax:
<h1>{dede:field name='typename'/}</h1>
<p>{dede:field name='description'/}</p>
<meta name="keywords" content="{dede:field name='keywords'/}" />
How typeid is involved: This tag is "context-aware." When you are on a channel page (e.g., yourdomain.com/plus/list.php?tid=3), DedeCMS automatically knows you are on channel ID 3. The {dede:field} tag then fetches the fields for that specific channel. You don't need to manually add typeid here, but it's being used "behind the scenes."
How to Find a Channel's typeid?
You need to know the ID number to use it. Here’s how to find it:
- Log in to your DedeCMS Backend.
- Go to the "Content Management" (内容管理) section in the left menu.
- Click on "Channel Management" (栏目管理).
- You will see a list of all your channels. The first column is "ID". This is the number you need for the
typeidparameter.
| ID | Order | Channel Name (栏目名称) | ... |
|---|---|---|---|
| 1 | 1 | Home (主页) | ... |
| 2 | 2 | News (新闻) | ... |
| 5 | 3 | Tech News (科技新闻) | ... |
| 8 | 4 | Products (产品) | ... |
From the table above:
- The
typeidfor "News" is2. - The
typeidfor "Tech News" is5.
Advanced Usage
a) Displaying Articles from Multiple Channels
You can specify multiple channel IDs by separating them with commas ().
Example: To display articles from both the "News" (ID 2) and "Products" (ID 8) channels:
{dede:arclist typeid='2,8' row='15'}
<!-- ... -->
{/dede:arclist}
b) Excluding a Channel
You can exclude a specific channel by prefixing its ID with a minus sign ().
Example: To display articles from all sub-channels of "News" (ID 2) except for "Tech News" (ID 5):
{dede:arclist typeid='2,-5' row='15'}
<!-- ... -->
{/dede:arclist}
Summary
| Parameter | What it Does | Common Tags |
|---|---|---|
typeid |
Specifies the channel ID to fetch content from. It's the core of content organization in DedeCMS templates. | {dede:arclist}, {dede:channel}, {dede:sql} (with joins), etc. |
In short, typeid is your bridge between your website's channel structure and the content you display on the front end. Mastering its use is essential for building dynamic and well-organized websites with DedeCMS.
