Of course! "Dede Addonarticle" (织梦文章模型) is a core and very powerful feature of the DedeCMS (织梦内容管理系统) website building system. Understanding it is key to building flexible and feature-rich websites with DedeCMS.

Let's break it down in detail.
What is Dede Addonarticle? (什么是Dede addonarticle?)
In simple terms, Addonarticle (附加文章模型) is a customizable article content model in DedeCMS.
By default, DedeCMS comes with a basic "Article" (文章) model. This default model has fixed fields like:(标题)
- Short Title (短标题)
- Author (作者)
- Source (来源)
- Publishing Date (发布日期)
- Content (内容)
However, when you build a website, you often need more specific information. For example:

- A Product page might need fields like
Price,Brand,Specifications, andProduct Image Gallery. - A Recipe page might need
Cooking Time,Servings,Ingredients, andDifficulty Level. - A Movie Review page might need
Director,Release Date,Rating, andCast.
This is where the Addonarticle model comes in. It allows you to create your own set of custom fields (called "additional fields" or "附加字段") to define the structure of your content, far beyond the default article fields.
Key Concepts and Terminology (核心概念与术语)
To understand how to use it, you need to know these key terms:
| Term (术语) | Chinese Name (中文) | Description (描述) |
|---|---|---|
| Content Model | 内容模型 | The overall structure or "template" for a type of content. It's a collection of fields. The "Addonarticle" is one type of content model. |
| Channel | 栏目 | A category on your website where content is published (e.g., "Products," "News," "Recipes"). Each channel is linked to a specific content model. |
| Field | 字段 | A single piece of data within a content model. Examples: title, price, image. |
| Field Type | 字段类型 | The format of a field. Common types include: • Text (文本): Single line of text. • Textarea (文本区域): Multi-line text for descriptions. • Editor (编辑器): The WYSIWYG editor for main content. • Image (图片): For uploading a single image. • Images (图片集): For uploading multiple images in a gallery. • Select (下拉): A dropdown menu for selecting one option. • Radio (单选): Radio buttons for selecting one option. • Checkbox (多选): Checkboxes for selecting multiple options. |
| Archives | 文档 | The individual piece of content you create (e.g., one product, one news article). An archive is an instance of a content model. |
How to Use Addonarticle? (如何使用Addonarticle?)
The process involves three main steps: creating the model, creating a channel for it, and then publishing content.
Step 1: Create a New Content Model (创建内容模型)
- Log in to your DedeCMS backend.
- Go to 核心 -> 内容模型管理 -> (点击) 添加内容模型 (Core -> Content Model Management -> (Click) Add Content Model).
- You will be presented with two options:
- 普通文章模型 (Ordinary Article Model): This is a standard model with some pre-defined fields. It's a good starting point.
- 独立模型 (Independent Model): This creates a completely new model from scratch. This is what you need for highly custom content like products or recipes.
- Choose 独立模型 (Independent Model).
- Fill in the details:
- 模型名称 (Model Name): A clear name, e.g., "Product Information".
- 模型表前缀 (Model Table Prefix): A unique prefix for the database tables, e.g.,
dede_addonproduct. DedeCMS will often suggest one. - 简介 (Description): A brief description of what this model is for.
- 列表命名规则 (List Naming Rule): How the URL for lists of this content will be structured (e.g.,
/a/product-{page}.html). - 命名规则 (Archive Naming Rule): How the URL for a single piece of content will be structured (e.g.,
/a/product-{id}.html).
- Click 确定 (Submit).
Step 2: Add Custom Fields to the Model (为模型添加字段)
After creating the model, you need to define its fields.

- In the 内容模型管理 (Content Model Management) page, find your new model in the list and click its 管理字段 (Manage Fields) link.
- You will now see the field management interface. You can add, edit, and delete fields here.
- Click 添加新字段 (Add New Field).
- Configure the field:
- 字段名称 (Field Name): A unique identifier, e.g.,
price. (Important: Use English letters and numbers only, no spaces or special characters.) - 字段提示文字 (Field Prompt Text): The label that will appear in the content editor, e.g., "Product Price".
- 字段类型 (Field Type): Choose the appropriate type, e.g., 数字 (Number) for a price.
- 默认值 (Default Value): An optional default value.
- 是否为空 (Is it Nullable?): Can this field be left empty when creating content?
- 是否在发布内容时显示 (Show when publishing content?): Usually, you'll want this checked.
- 字段名称 (Field Name): A unique identifier, e.g.,
- Click 保存 (Save).
- Repeat this process to add all your necessary fields (e.g.,
brand,specs,gallery, etc.).
Step 3: Create a Channel for the Model (创建栏目)
Now you need a place on your website to publish this new type of content.
- Go to 核心 -> 栏目管理 -> (点击) 添加主栏目 (Core -> Channel Management -> (Click) Add Main Channel).
- Fill in the basic channel information:
- 栏目名称 (Channel Name): e.g., "Products".
- 模型 (Channel Content Model): This is the crucial step! Select the custom model you just created (e.g., "Product Information") from the dropdown menu.
- 其他设置 (Other Settings): Choose the template for the list page (
list_product.htm) and the article page (article_product.htm). You will need to create these template files in your/templets/default/directory.
- Click 确定 (Submit).
Step 4: Publish Content (发布内容)
- Go to 核心 -> 添加文档 (Core -> Add Archive).
- You will now see a familiar publishing form, but it will include your custom fields (e.g., "Product Price", "Brand") alongside the standard ones.
- Fill in all the information, including your new custom fields.
- Click 确定 (Submit).
Your new content is now live on your website, structured exactly how you defined it!
Advantages of Using Addonarticle (使用Addonarticle的优势)
- Flexibility: You can design content structures perfectly suited to your website's needs, not limited by a default template.
- Data Integrity: Enforces a consistent data structure. All "products" will have a price, a brand, etc., making your data clean and easy to manage.
- Improved User Experience: Visitors get a richer, more informative experience because they see all the relevant details for a specific type of content.
- Powerful Templating: You can easily call and display these custom fields in your templates using DedeCMS's tags, allowing for complex and dynamic layouts.
Example Scenario: Building a Product Page
Let's put it all together for a simple e-commerce site.
- Create Model: Name it "Product", table prefix
dede_addonproduct. - Add Fields:
price(Type: Number, Prompt: "Price")brand(Type: Text, Prompt: "Brand")main_image(Type: Image, Prompt: "Main Product Image")image_gallery(Type: Images, Prompt: "Image Gallery")
- Create Channel: Name it "Our Products", link it to the "Product" model, and assign
list_product.htmandarticle_product.htmtemplates. - Create Templates:
- In
article_product.htm, you can use tags like{dede:field.price /},{dede:field.brand /}, and{dede:field.image.gallery /}to display the product details.
- In
- Publish Content: When you add a new "document" to the "Our Products" channel, you'll be prompted to enter a price, brand, and images.
Important Considerations
- Performance: Each custom field adds a small amount of overhead. While generally not an issue for small to medium sites, thousands of complex custom fields on a high-traffic site could have a minor impact.
- Template Development: You need to understand DedeCMS template syntax (
{dede:field.xxx}) to display the custom fields on the front end. - Updates: Changing a field's type or name after content has been created can be complex and may require database adjustments. It's best to plan your fields carefully from the start.
In summary, Dede Addonarticle is the engine that makes DedeCMS a versatile CMS. It moves beyond a simple blog system and allows you to build almost any kind of content-driven website.
