Kill lui lei Dog---dedecms----2 Quick Start play the relationship between the four tables Dede

Source: Internet
Author: User

For example, a novel website, there are many types of Web site so that we have a variety of novels in the network he has many categories, such as:

Fantasy.... Fantasy.... Xian-man .... Martial arts.... Literature.... A different world .... City.... Military.... History.... Supernatural .... Suspense.... Game.... Science fiction.... Classification of the workplace and so on

We're in the dedecms. These categories are called columns, and if we want to add a category only one column can be added in the background, as shown below:

This creates a column, and so on, we create a few more

Then to the front desk to see the effect of the results in the navigation bar changes can be, the effect is as follows

After we have classified the novel, then of course the next step is to store the novel in it, otherwise we take what to earn the money of fiction fans? Hee Hee

Then save it

Let's see if it has been saved successfully, as shown in the effect:

Let's look at the effect on the homepage:

Really saved successfully, we click to see how the effect:

Let's add several more novels in that way, as follows:

Has been added, we look at the first page of how the effect:

We only need to add Wenzhan in the background after our home page almost all help us to complete a large part of the work, and casually click on a can jump to the novel just now

Our dedecms is mainly dependent on four tables, each of them:

Dede_channeltype (model table) This table is where they officially design n multiple models, whether that column belongs to a model or not.

We never publish a new article when we have to choose a column, these columns are a model of a sub-class

Dede's designers think that each column belongs to a certain type, such as the fantasy novel we just created, fantasy novels, fairy stories and so on are all types of articles, so their information will be stored in the table Dede_channeltype.

The designers have defined 5 models for us, and if not enough we can define a model for ourselves.

The second table is dede_arctype (column table), which records all of our column information.

All of our added columns, regardless of the column under that model, will be saved to the Dede_arctype table.

Column table and model table they are associated by the Channeltype field, which means that the column belongs to the model.

We return to the Dede_channeltype model table to see what the ID 1 is the model can be judged that this column belongs to the model:

So their relationship is more clear, hehe ...

The third table is dede_archives (the main table of the article), we have just added a new novel in this table can be seen in detail, including thumbnails have detailed storage

This watch doesn't matter if you post a new article under that model or under that column, or the content will be stored in the main table, because they all have common information, such as the title. Number. Ctr etc...

So the common fields are made into a table dede_archives (inside the main table)

Main Table and column table They are also related, (dede_archives) The typeid of the main table is associated with the ID of the (Dede_arctype) column table.

Dedecms's designers have also designed a more convenient way for us to know that our "Bucket of Heaven" fiction belongs to that model,

The ID field of the (Dede_channeltype) model table can also be associated with the (dede_archives) Main Table's Channel field ...

The four important tables are dede_addonarticle (additional table)

Dedecms's designers believe that both the article and the product will have the same information, they are stored in the (dede_archives) Main Table,

But for example our common novel website, the novel has the author who, again but if is in the shopping mall, the commodity may not necessarily have the author who is.

So they generate a corresponding (dede_addonarticle) additional table for each model. Their indication rule is: dede_addonxxx (XXX denotes model)

(dede_addonarticle) The ID in the attached table points to the ID in the (dede_archives) Main Table

(dede_addonarticle) The ID of the typeid point (dede_arctype) column in the attached table

Kill lui lei Dog---dedecms----2 Quick Start play the relationship between the four tables Dede

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.