dede article_article是什么?

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

Of course. Let's break down dede_arcticle in the context of the DedeCMS (织梦内容管理系统) framework.

dede article_article
(图片来源网络,侵删)

This is a core component, and understanding it is essential for working with DedeCMS.


What is dede_arcticle?

dede_arcticle is the primary table in the DedeCMS database used to store the content of articles, also known as "archives" or "documents" (文档).

Think of it as the central repository for all the articles you publish on your DedeCMS-powered website. Every time you create and save a new article through the backend admin panel, a new record is created or an existing one is updated in this table.

Key Characteristics:

dede article_article
(图片来源网络,侵删)
  • Table Name: In the database, it's literally named dede_arcticle. The dede_ prefix is the default for all DedeCMS tables and can be changed during installation.
  • Purpose: It holds the structured data for every article, including its ID, title, content, author, publishing date, and much more.
  • Core Entity: It is the heart of the content management system. Other tables, like dede_arctype (for categories) and dede_archives (a more general archive table), link to it.

Key Fields (Columns) in the dede_arcticle Table

Here are the most important fields you'll encounter, grouped by their function:

A. Identification & Linkage

  • id: The unique primary key for this article record. It's an auto-incrementing integer.
  • typeid: The ID of the category this article belongs to. This is a foreign key that links to the id field in the dede_arctype table.
  • typeid2: An optional second category ID, allowing an article to belong to two categories (though this feature is less commonly used).
  • arcrank: The article's status.
    • 0: Published (publicly visible).
    • -1: Draft (not visible to the public).
    • -2: Deleted (in the trash/recycle bin).
    • Other positive values can be used for specific permission levels.
  • channel: The ID of the content channel. 1 is the default "article" channel, but it can be others like "download," "product," etc.

B. Content & Metadata

  • title: The title of the article. Important: This field has a limited length (usually 255 characters). For longer titles, DedeCMS uses the title field in the dede_archives table, which is generally linked to this one.
  • shorttitle: A shorter version of the title, often used in lists or SEO titles.
  • writer: The author's name.
  • source: The source of the article (e.g., another website, a newspaper).
  • litpic: The path to the article's thumbnail or featured image.
  • description: A brief summary or description of the article. Often used for the meta description in SEO.
  • keywords: A comma-separated list of keywords for the article. Often used for meta keywords.
  • pubdate: The publication date and time, stored as a Unix timestamp.
  • senddate: The date the article was submitted/created, also a Unix timestamp.
  • sortrank: An integer used for manual sorting. Articles with a lower number appear first. If two articles have the same number, the one with the later pubdate comes first.

C. The Body Content

  • body: This is the most crucial field. It stores the full HTML content of the article. This is where your text, images, videos, and formatted layout go. It's a TEXT or MEDIUMTEXT field type to accommodate large amounts of content.

D. Interaction & System Fields

  • click: The number of times the article has been viewed. This is automatically incremented when someone visits the page.
  • lastpost: The username of the last person to comment on the article.
  • postnum: The total number of comments on the article.
  • flag: A field used to store special flags for the article, like whether it's recommended (c), on the homepage (h), or an image article (p). These are single letters.
  • notpost: A flag indicating if the article has been posted to the front page and category pages (0 for yes, 1 for no).

Relationship with Other Core Tables

You rarely work with dede_arcticle in isolation. It's part of a relational database structure.

Table Name Relationship to dede_arcticle Purpose
dede_archives One-to-One This is the master table for all content. dede_arcticle is a "channel-specific" table for the article channel. The dede_archives table contains common fields like id, typeid, arcrank, title, pubdate, etc. The id in dede_archives is the same as the id in dede_arcticle. This design allows DedeCMS to manage different content types (articles, downloads, products) under a single system.
dede_arctype One-to-Many (via typeid) This table defines your categories (e.g., "News," "Tutorials," "About Us"). Each article in dede_arcticle has a typeid that points to a category in dede_arctype.
dede_addonarticle One-to-One In newer versions of DedeCMS, the main article content (body) has been moved to this separate table to improve performance. The dede_arcticle table then contains a link to the record in dede_addonarticle using the aid field. This is a key optimization.
dede_taglist / dede_taglist Many-to-Many These tables manage tags. An article can have many tags, and a tag can be associated with many articles. This is a classic many-to-many relationship, managed through linking tables.

How to Use It (Practical Examples)

A. For a Developer (SQL Queries)

To get the 10 most recent published articles from the "News" category (assuming category ID is 5):

SELECT
    a.id,
    a.title,
    a.description,
    a.pubdate,
    a.litpic,
    t.typename
FROM
    dede_arcticle AS a
JOIN
    dede_arctype AS t ON a.typeid = t.id
WHERE
    a.typeid = 5 AND a.arcrank = 0
ORDER BY
    a.sortrank ASC, a.pubdate DESC
LIMIT 10;

B. For a Template Designer (DedeCMS Tags)

In your DedeCMS template files (.htm), you use the built-in DedeCMS tags to query this data.

dede article_article
(图片来源网络,侵删)

Example 1: Displaying a list of articles in a specific category.

{dede:arclist typeid='5' titlelen='50' row='10'}
    <li>
        <a href="[field:arcurl/]">[field:title/]</a>
        <span class="date">[field:pubdate function="MyDate('Y-m-d',@me)"/]</span>
    </li>
{/dede:arclist}
  • {dede:arclist ...}: This is the tag that queries the dede_arcticle (and related) tables.
  • typeid='5': Specifies to get articles from the category with ID 5.len='50'`: Limits the title to 50 characters.
  • row='10': Shows 10 articles.
  • [field:arcurl/]: A placeholder for the article's full URL.
  • [field:title/]: A placeholder for the article's title.

Example 2: Displaying the full content of a single article.

This is typically done on a page like article_article.htm. The system automatically passes the article's ID to the template.

<h1>[field:title/]</h1>
<div class="info">
    Author: [field:writer/] | Date: [field:pubdate function="MyDate('Y-m-d',@me)"/] | Views: [field:click/]
</div>
<div class="content">
    [field:body/]
</div>
  • [field:body/]: This is the key tag that outputs the full HTML content from the body field of dede_arcticle.

Summary

Aspect Description
What it is The main database table for storing article content in DedeCMS.
Key Fields id, typeid, title, body, pubdate, litpic, click.
Relationship Links to dede_archives (master), dede_arctype (categories), and dede_addonarticle (content body in newer versions).
How to Use Accessed via SQL queries for direct database work or via DedeCMS tags ({dede:arclist}, {dede:field}) in templates.

Understanding dede_arcticle is fundamental to customizing, developing, or debugging a DedeCMS website.

-- 展开阅读全文 --
头像
织梦dede datalist如何调用图片?
« 上一篇 12-02
织梦5.7如何用list标签调用独立模型?
下一篇 » 12-02

相关文章

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

目录[+]