dede addoninfos

99ANYc3cd6
预计阅读时长 22 分钟
位置: 首页 DEDE建站 正文

Of course! Let's dive deep into dede_addoninfos.

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:

dede addoninfos
(图片来源网络,侵删)
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?

  1. Installation: When you install a new add-on through the DedeCMS backend, the installation script typically inserts a new row into the dede_addoninfos table, populating fields like name, memo, intro, and setting the initial isshow value to 0 (disabled) or 1 (enabled).

  2. Enabling/Disabling: The admin panel provides an interface to manage add-ons. When you click "Enable" or "Disable," DedeCMS simply updates the isshow field for that add-on's aid from 0 to 1 or 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.

  3. Configuration: When you click "Settings" for an add-on, DedeCMS fetches the row for that aid, reads the config field (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 the config field.

    dede addoninfos
    (图片来源网络,侵删)
  4. Front-end Display: In your DedeCMS templates (.htm files), you can use specific DedeCMS tags (like {dede:likearticle}) to call a particular add-on. The system looks up the add-on's information in dede_addoninfos to confirm it's enabled (isshow = 1) and then retrieves its configuration from the config field to display the content correctly.


Practical Example: The "Related Articles" Add-on

Let's imagine the "Related Articles" add-on.

  1. In the Database (dede_addoninfos):

    • aid: 5
    • name: "相关文章" (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
  2. 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}
  3. How it Works:

    • DedeCMS sees the {dede:likearticle} tag.
    • It queries the dede_addoninfos table for the add-on that handles this tag (likely by name or module).
    • It finds the record with isshow = 1.
    • It reads the config field 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.

Common Issues and Troubleshooting

  • Add-on not showing: The first thing to check is the isshow field for that add-on's aid in the dede_addoninfos table. It might have been accidentally set to 0.
  • Add-on settings lost: If you save settings and they disappear, the config field might be corrupted, or the add-on's files might be missing. Check the file permissions and the integrity of the config data.
  • Error after an update: Sometimes, a DedeCMS core update can change the structure of the dede_addoninfos table, 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.

-- 展开阅读全文 --
头像
c语言程序设计 pdf 苏小红
« 上一篇 01-09
{dede:feedback}标签具体实现什么功能?
下一篇 » 01-09

相关文章

取消
微信二维码
支付宝二维码

目录[+]