DEDECMS Custom Model Usage Tutorial

Source: Internet
Author: User

Intermediary transaction SEO diagnosis Taobao guest Cloud host technology Hall

in the dream system has the concept of content model, different content models can be used to build different content forms of sites, in the system with the following models: Ordinary articles, Atlas, software, commodities, classified information, topics.        Through the system's own model, we can use to build different types of sites, such as: The use of Atlas can do a picture station, the software model to build a software download site.        Of course, the model attached to the system is called the system model, users can define some models, such as books, music albums, etc., customized to build more content forms of the site, this article will describe how to use the system's custom Model management functions to implement the content model. We first login to the system background, click [Core]-[content Model Management], into the Content Model Management interface, as shown in the following figure:

Here we introduce the concepts of several related parameters:

        ID number is used to differentiate the unique ID of the model, the general general model ID is greater than 0, such as ordinary articles, software, etc., if the use of a single table model, the ID generally need to be less than 1, For example, the taxonomy information model here, the         channel name identifies the channel type identification;         Identification ID system is used to identify the ID, which is related to the template aspect;         attached table System content additional table entries;          model types are divided into system type and automatic type, the system type is the content model that is solidified in the system, the automatic type is the content model type that user can create;          Next we start by introducing how to use custom Model Management to create your own model and to build Web sites of different content types.         here we introduce some surrounding content, several concepts to use:         field In a database, a table column is called a field, and so is the dream system, but more appropriately, storing a content information unit, called a field, such as a title, source, author, and so on, is a field;         The Content System Main Table program stores some common fields in the System Main Table dede_archives, for example: title, keywords, thumbnails, etc., the main table specific fields can be queried the Dream Help Center (http://help.dedecms.com) of the two Development manual data Sheet section of the content;         attached table different content models correspond to different additional tables, usually named dede_addon[identification IDs, and the attached table contains the relevant fields (not public) for the details. For example: article content (dede_addonarticle), software type (dede_addonsoft), picture Collection(dede_addonimage);         single table independent model storage without the "Main Table + additional table" structure form, directly using a single data table for storing content data, In this way, the data load problem can be solved to a large extent by reducing the main Table data service cost by;         the master table. Understanding the above concepts we can learn how to create a content model ourselves.         A complete content model contains 4 parts of model data tables, data fields, model templates, model parameters, There are several steps to making a content model: 1. Model planning; 2. Model making; 3. template making; 4. Column settings, below we from the above 4 steps to explain the production of the content model. Here we take a book model as an example, the main function of this model is to introduce books.          Model Planning         Model planning is divided into several parts, one is the model application planning, followed by the field of information planning, with the book model as an example, we are planning a channel to use this model, the channel is to let you share some good learning materials, here is the main programming books, So the column is divided roughly as follows: The following is the content of the reference:


[Network programming books]     |____[asp related]      |____[php      |____[ JSP related]      |____[. NET related]         these columns are to support members to contribute, because this is not a lot of recommended books, so directly using the form of master-slave table, do not use independent single table model, because it involves member sharing, Therefore, we need members to submit contributions, we have to contribute to the membership level set for intermediate members have access to, and need to summary and said sketch, after the post needs to be audited by the administrator, so the basic use of planning to complete, the following is the field of planning.         because of the introduction of a book, we have planned the following: publishing house publish single-line text (varchar) Publication time Pubtime time type word number Cnum integer type Edition pubnum integer type page pagenum integer type printing time Pritime time Type folio kbook single-line text (varchar) printed prinum integer type paper pages single line text (varchar) I S B N ISBN single-line Text (varchar) Wrapping packs Single-line text (varchar) Introduction Body HTML text Author introduction wrbody HTML text directory bindex HTML text           So, we completed the first step of the model planning.          model making         planning completed, Next we start to create the content of these plans as a content model. First log in to the system background as a super administrator. Click on [Core]-[Model Management] and click on the "Add New Model" button to create the model.         Configure the basic information of the model according to the system prompts,To select the automatic model, so the file release of the pipeline Program page only need to retain the default. Because we are publishing a book, so here "title use name" set to: Book name.

because we are using the automatic model, do not make the appropriate release management program, so the following relevant model release program to keep the default, of course, if you have a certain degree of programming ability, you can make a content publishing program, and then specify here.

basic information set up, directly Click OK, go to the Field Management page, click on the field management of the "Add New Field" button, enter the field add page, we based on the relevant field information for field additions. Here are some field types we have some descriptions of the fields: The following are references:


single-line text (varchar): Commonly used segments, such as the title of the article, the author and so on are directly input a small amount of text, set this text to specify the length of the text, the default is 250, if greater than 255 is the text type multiline text: is also a more common type of field, such Product descriptions can store HTML text using multiple lines of text: Edit the resulting HTML content in the Dream editor for more complex content forms attachment type: Can upload the attachment background to allow users to download, attachment type can be set in the Background option Drop-down box: Drop-down selection, generally used for such as software type, Language types, such as field linkage type: An array of data types, can be set in the system background linkage type management to understand these field types we can add our field information.

Add complete Click OK, so we completed the production of this model.  After the model has been added, we find that there is an additional option to publish the book in the place where the content is published, which shows that our model has been successfully added.

Template making

We understand that each model also needs to produce the corresponding model template file through the "main template file and function description" of the Dream Help Center, we can view the template file through the template file description in the background Model Management.

template production mainly has 2 places to explain. 1. List page template list_[recognition id].htm A field that needs to be called to add an extension in the list needs to be checked on the Add Field page to make the field available in the underlying template of the list (custom fields are displayed by default only in document templates. Enabling this option slows down list queries and does not select if necessary        so that [field:fieldname/] can be invoked in the {dede:list/} tab.         2. The label for the content page can be invoked using {dede:field.fieldname/}, which can refer to the Help Center template-related assistance documentation. Column settings Next we can add a column in the column settings in the column content model set to book

then we can add the document under this column, we will find that we can now publish the content of the book

After the

is added, we can browse our website page and preview our model effects.

        at this point we have completed the entire model, the whole process is very simple. Here only introduced the production of automatic model, of course, a certain PHP based users can develop their own system model, which will have a more powerful dream system, so that the content of the site more rich.
Related Article

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.