Of course! The dede_field name is a core concept in the DedeCMS (织梦内容管理系统) database. It's the central table that stores the custom fields for your website's content.

Let's break it down in detail.
What is dede_field?
In simple terms, dede_field is a lookup table that defines all the extra, user-defined fields you can add to a specific content model (also called an "arctype" or channel).
Think of it this way:
dede_archives: This table holds the standard, fixed information for every article, like its title, author, publishing date, and the main body content.dede_field: This table holds the definitions for additional information you might want to capture. For example, if you're running a product review site, you could add custom fields like "Product Rating," "Price," or "Release Date." Thedede_fieldtable stores the names and properties of these custom fields.
Every time you create a new content model in the DedeCMS backend (e.g., "Products," "Downloads," "Staff Members"), DedeCMS creates a corresponding table in the database (like dede_addonproducts) to store the data for that specific model. The dede_field table tells DedeCMS what fields to create in that new table.

Structure of the dede_field Table
Here are the most important columns in the dede_field table and what they mean:
| Column Name | Data Type | Description |
|---|---|---|
id |
mediumint(8) unsigned |
Primary Key. A unique number for each custom field definition. |
fieldset |
varchar(30) |
The name of the content model this field belongs to. This is the most important column for linking fields to a specific model. |
fieldname |
varchar(50) |
The internal name of the field (e.g., price, rating, author_intro). This is what the system uses to reference the field. |
dtype |
varchar(20) |
The data type of the field. Common values include: text (single line), textarea (multi-line), select (dropdown), radio (radio buttons), img (image upload), datetime (date and time), etc. |
issystem |
smallint(1) |
A flag to indicate if it's a system field (1) or a user-defined field (0). Most of your custom fields will be 0. |
fieldsetid |
smallint(5) unsigned |
The ID of the fieldset the field belongs to. This is used for organizing fields into groups on the editing page. |
item |
text |
Stores options for fields like select, radio, or checkbox. For example, for a rating field, this might contain "5:Very Good,4:Good,3:Average,2:Bad,1:Terrible". |
normbody |
text |
Default value for the field. |
ifshow |
smallint(1) |
Whether the field is displayed on the frontend (the public-facing part of your website). 1 for yes, 0 for no. |
How It Works: A Practical Example
Let's imagine you want to create a content model for "Book Reviews".
Step 1: Create the Content Model in DedeCMS Backend
- Go to
核心->内容模型管理->增加一个内容模型. - Fill in the details:
- 模型名称: Book Reviews
- 模型表:
dede_addonbook(DedeCMS will suggest this)
- Click "Submit".
Step 2: Add Custom Fields
- Go to
内容模型管理->管理字段. - You will see a dropdown for your new model ("Book Reviews"). Select it.
- Now, add the fields you need. For each field, you'll define its properties:
- Field 1: "Book Author"
字段名:book_author- :
Book Author 字段类型:text
- Field 2: "My Rating"
字段名:my_rating- :
My Rating (out of 5) 字段类型:radio字段参数:5:Five Stars,4:Four Stars,3:Three Stars,2:Two Stars,1:One Star
- Field 3: "Book Cover Image"
字段名:book_cover- :
Book Cover Image 字段类型:img
- Field 1: "Book Author"
What Happens in the Database?
- A new table named
dede_addonbookis created. It will have the standard columns plus the new ones you defined:book_author,my_rating, andbook_cover. - Three new rows are added to the
dede_fieldtable:- One for
book_author. - One for
my_rating. - One for
book_cover. - The
fieldsetcolumn for all these rows will be'book'(or whatever you named your model).
- One for
When you now go to write a new "Book Review," DedeCMS checks the dede_field table for all fields where fieldset = 'book' and displays them on the editing form based on their dtype and titlename.
Why is Understanding dede_field Important?
-
Templating (Frontend Development): To display the content of a custom field in your template files (
.htm), you use thefieldfunction. For example, to display the book author, you would use:{dede:field name='book_author'/} -
PHP Development: If you are writing a custom PHP script to get article data, you'll need to know the field names to query them from the corresponding addon table (e.g.,
dede_addonbook). -
Debugging: If a custom field is not showing up on the frontend or backend, the problem is often in the
dede_fieldtable. You might find:- The
fieldsetname is incorrect. - The
ifshowvalue is0. - The
titlenameis empty.
- The
-
Data Migration: When moving a DedeCMS site, you must not only back up the data tables (
dede_archives,dede_addon*) but also thedede_fieldtable, otherwise, you will lose all your custom field definitions.
