Of course! Let's dive deep into dede_addoninfos.

What is dede_addoninfos?
In the context of the DedeCMS (织梦内容管理系统) content management system, dede_addoninfos is a MySQL database table.
Its primary purpose is to store metadata and configuration information for the various "add-ons" (插件) that extend the core functionality of DedeCMS.
Think of it as a central registry or an "app store" database for DedeCMS plugins. When you install, enable, disable, or configure an add-on, DedeCMS interacts with this table to keep track of its state and properties.
Key Columns in the dede_addoninfos Table
While the exact columns can vary slightly between different DedeCMS versions, the table generally contains the following core fields:

| Column Name | Data Type | Description |
|---|---|---|
aid |
int(10) or mediumint(8) |
Primary Key. The unique ID for the add-on. |
name |
varchar(100) |
The display name of the add-on (e.g., "相关文章", "评论模块"). |
memo |
varchar(255) |
A short description or memo about what the add-on does. |
intro |
text |
A more detailed introduction or description for the add-on, often shown on the plugin management page. |
isshow |
smallint(1) or tinyint(1) |
A flag indicating if the add-on is currently enabled (1) or disabled (0). This is a crucial field for controlling functionality. |
filelist |
text |
A list of files that belong to this add-on. This is often used for tracking which files should be included or managed by the plugin. |
config |
text |
Very Important. Stores serialized configuration data for the add-on. When you change settings in the admin panel for a specific add-on, these settings are usually saved here as a string (e.g., a JSON or PHP serialized array). |
usergroup |
varchar(100) |
Defines which user groups have permission to manage or use this add-on. For example, 'admin' or a specific editor role. |
module |
varchar(20) |
Often indicates the type or category of the add-on, linking it to a specific DedeCMS module (e.g., 'article' for content-related add-ons). |
displayorder |
smallint(3) |
An integer used to control the order in which add-ons are listed in the admin panel. Lower numbers appear first. |
What is an "Add-on" (插件) in DedeCMS?
An "add-on" in DedeCMS is a modular piece of code that can be installed to add new features without modifying the core system files. This is a key principle of good CMS design. Examples of add-ons include:
- Content-related: "Related Articles," "Random Articles," "Hot Articles."
- User interaction: "Comment System," "Guestbook."
- Functional: "Ad Management," "Link Exchange," "RSS Feed Generator."
- SEO tools: "Sitemap Generator," "XML-RPC Publishing."
How is dede_addoninfos Used?
-
Installation: When you install a new add-on through the DedeCMS backend, the installation script typically inserts a new row into the
dede_addoninfostable, populating fields likename,memo,intro, and setting the initialisshowvalue to0(disabled) or1(enabled). -
Enabling/Disabling: The admin panel provides an interface to manage add-ons. When you click "Enable" or "Disable," DedeCMS simply updates the
isshowfield for that add-on'saidfrom0to1or vice-versa. The system's front-end code will then check this flag to decide whether to load and execute the add-on's logic. -
Configuration: When you click "Settings" for an add-on, DedeCMS fetches the row for that
aid, reads theconfigfield (which it unserializes), and displays the current settings in a form. When you save the form, the new settings are re-serialized and saved back to theconfigfield.
(图片来源网络,侵删) -
Front-end Display: In your DedeCMS templates (
.htmfiles), you can use specific DedeCMS tags (like{dede:likearticle}) to call a particular add-on. The system looks up the add-on's information indede_addoninfosto confirm it's enabled (isshow = 1) and then retrieves its configuration from theconfigfield to display the content correctly.
Practical Example: The "Related Articles" Add-on
Let's imagine the "Related Articles" add-on.
-
In the Database (
dede_addoninfos):aid:5name: "相关文章" (Related Articles)memo: "Displays articles with similar tags."isshow:1(Enabled)config:a:3:{i:"title";s:"相关文章";i:"rownum";i:"10";i:"typeid";i:"0";}(This is a PHP serialized array meaning the title is "Related Articles", it shows 10 rows, and it's not limited to a specific category).displayorder:1
-
In the Template (
article_article.htm): You might have this tag in your article template:{dede:likearticle titlelen='42' row='10'} <li><a href="[field:arcurl/]">[field:title/]</a></li> {/dede:likearticle} -
How it Works:
- DedeCMS sees the
{dede:likearticle}tag. - It queries the
dede_addoninfostable for the add-on that handles this tag (likely by name or module). - It finds the record with
isshow = 1. - It reads the
configfield to get the default settings (though in this case, the tag attributes override them). - It then executes the logic of the "Related Articles" add-on to find and display the linked articles.
- DedeCMS sees the
Common Issues and Troubleshooting
- Add-on not showing: The first thing to check is the
isshowfield for that add-on'saidin thedede_addoninfostable. It might have been accidentally set to0. - Add-on settings lost: If you save settings and they disappear, the
configfield might be corrupted, or the add-on's files might be missing. Check the file permissions and the integrity of theconfigdata. - Error after an update: Sometimes, a DedeCMS core update can change the structure of the
dede_addoninfostable, leading to errors. You may need to run a database repair script or update the add-ons themselves.
In summary, dede_addoninfos is the central nervous system for DedeCMS's plugin architecture. It's a simple but powerful table that allows the CMS to dynamically manage its extended features without being bogged down by hard-coded logic.
