dede field.reid

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

Of course. Let's break down dede_field.reid in detail.

dede field.reid
(图片来源网络,侵删)

High-Level Summary

dede_field.reid is a specific field name used within the data structure of the DedeCMS (织梦CMS) content management system. It is an integer field that stores the ID of a related document (article).

In simple terms, it's a database column designed to create a link or relationship from one piece of content to another.


Detailed Breakdown

The Context: DedeCMS

To understand dede_field.reid, you must first understand DedeCMS.

  • What it is: DedeCMS is a very popular open-source PHP content management system (CMS) widely used in China, especially for building websites like portals, news sites, and blogs.
  • How it Works: It uses a MySQL database to store all website content, including articles, categories, member information, etc. Each table in the database corresponds to a type of content.
  • dede_field Table: This is a core table in DedeCMS. It's a flexible field table, also known as an "extended field" table. Instead of having dozens of columns for every possible piece of information (like keywords, source, author, related_links), DedeCMS stores these variable fields in the dede_field table. This makes the system highly customizable.

The Field Name: reid

The name reid is an abbreviation. The most common and accepted meaning is:

dede field.reid
(图片来源网络,侵删)
  • related id
  • reference id

Both interpretations point to the same function: it holds the primary key (the ID) of another document in the dede_archives table (the main table for articles).

The Purpose: Creating Relationships

The primary purpose of the reid field is to link one article to another. This is used for features like:

  • Related Articles (相关文章): This is the most common use. An article might have a section at the bottom titled "You might also like." The reid field in the extended fields for that article would contain the IDs of the articles it should link to.
  • Source Attribution (文章来源): Sometimes, an article is a summary or a reprint from another source. The reid could store the ID of the original article on the same or a different site.
  • Custom Content Relationships: A developer could use this field to create any custom one-to-many relationship between content items. For example, linking a "project" article to multiple "case study" articles.

How it Works in the Database

Let's visualize it with an example.

Table: dede_archives (Main Articles Table) This table holds the core information for every article.

id (Primary Key) title typeid ...
10 How to Optimize Website Speed 5 ...
11 The Best SEO Practices in 2025 5 ...
12 A Guide to DedeCMS Templates 3 ...

Table: dede_field (Extended Fields Table) This table stores the extra fields for articles. The aid column links back to the id in dede_archives.

aid (Foreign Key) reid keywords source ...
10 11 speed, optimization, website admin ...
11 NULL seo, google, ranking admin ...
12 NULL dedecms, template, php admin ...

In this example:

  • The article with id 10 ("How to Optimize Website Speed") has an extended field reid with a value of 11.
  • This tells the DedeCMS system: "For article #10, the related article is article #11."
  • When displaying the page for article #10, the system would query the dede_archives table to get the title for id 11 ("The Best SEO Practices in 2025") and display it as a related link.

Practical Usage (for Developers)

If you are a developer working with a DedeCMS website, you would typically encounter and use reid in the following ways:

In PHP (Template Logic)

In a DedeCMS template file (.htm), you would use PHP code within {dede} tags to retrieve and display the related articles.

{dede:sql sql="SELECT * FROM dede_archives WHERE id IN (~reid~)"}
    <li>
        <a href="[field:arcurl/]">[field:title/]</a>
    </li>
{/dede:sql}
  • ~reid~ is a placeholder that DedeCMS replaces with the actual value of the reid field for the current article.

Direct Database Query (MySQL)

If you need to query the database directly, you would use a JOIN to get all the necessary information in one go.

SELECT
    a.id,
    a.title,
    r.title AS related_title
FROM
    dede_archives AS a
JOIN
    dede_field AS f ON a.id = f.aid
JOIN
    dede_archives AS r ON f.reid = r.id
WHERE
    a.id = 10; -- Find the main article and its related one

This query would return: | id | title | related_title | | :--- | :--- | :--- | | 10 | How to Optimize Website Speed | The Best SEO Practices in 2025 |

Summary Table

Aspect Description
System DedeCMS (织梦CMS)
Table dede_field
Field Name reid
Data Type INT (Integer)
Purpose To store the ID of a related document/article.
Common Use Implementing "Related Articles" functionality.
Relationship Creates a one-way link from one article (aid) to another (reid).
-- 展开阅读全文 --
头像
c 语言程序设计实验指导郑莉
« 上一篇 01-07
织梦5.7sp1补丁包
下一篇 » 01-07

相关文章

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

目录[+]