Dedecms custom model graphic use tutorial

Source: Internet
Author: User
Tags php basics
In the Zhimeng system, there is the concept of content model. different content models can be used to build sites with different content forms. The system includes the following models: general articles, Atlas, software, products, classified information, and topics. Through the built-in model of the system, we can be used to build different types of sites. for example, we can use an atlas to create an image site, and use software to have the concept of a content model in the dream system, different content models can be used to build sites with different content formats. in the system, they include the following models: common articles, Atlas, software, products, classification information, and topics. Through the built-in model of the system, we can be used to build different types of sites. for example, we can use the gallery to create an image site and use the software model to build a software download site.
Of course, the model that comes with the system is called the system model. you can define some models by yourself, such as books and music albums, you can customize these models to build more content-based sites. This article describes how to use the custom model management function of the system to build a content model.
First, log on to the system background and click [core]-[content model management] to go to the content model management interface, as shown in:
  



Here we will introduce several related parameter concepts: ID No.Unique ID used to differentiate models. Generally, the IDs of common models are greater than 0, such as common articles and software. if a single table model is used, the IDs must be less than-1, for example, the classification information model here; Channel nameIdentifies a channel type; Recognition IdId used by the system for identification, which is related to the template; Additional tableAdditional table items of the system content; Model typeIt can be divided into system type and automatic type. The system type is the content model solidified in the system, and the automatic type is the content model type that users can create; next, we will introduce how to use custom model management to create your own model and use it to build websites with different content types. Here we will introduce some peripheral content and several concepts to be used: FieldIn a database, columns in a table are called Fields. this is also true for the weimeng system. but more appropriately, a content information unit is stored as a field, for example, the title, source, and author are all fields; Content System master tableThe program stores some common fields in the system master table dede_archives, such as: Title, keywords, thumbnails, etc. the main table specific fields can be queried dream Help Center (http://help.dedecms.com) of the secondary development manual; Additional tableDifferent content models correspond to different additional tables, usually named after dede_addon [recognition ID]. the additional tables store fields related to the detailed content (not public), for example, dede_addonarticle), software type (dede_addonsoft), image set (dede_addonimage), etc; Single table independent modelDuring storage, you do not need to use the structure of "primary table + additional table" to directly store content data using a single data table. this frees you from the master/slave table and reduces the overhead of the primary table data server, we can solve the data load problem to a large extent. after understanding the above concepts, we can learn how to create a content model on our own. A complete content model consists of four parts: Model data table, data field, model template, and model parameter. to create a content model, follow these steps: 1. model planning; 2. model creation; 3. template creation; 4. topic settings. The following describes how to create a content model from the above four steps. Here we use a book model as an example. The main function of this model is to introduce books. Model planningModel planning consists of model application planning and field information Planning. taking the book model as an example, we plan a channel to use this model, the function of this channel is to share some good learning materials. here we mainly use programming books, so the sections are roughly divided as follows: [network programming books] |____ [ASP-related] |____ [PHP-related] |____ [JSP-related] | ____[. NET-related] These columns support contributions from members. because there are not many recommended books, they are directly in the form of master-slave tables. they do not use an independent single-table model because they involve member sharing, therefore, we need to submit contributions to members here. we set the level of contribution to members as intermediate members to have the permission, and we need to abstract and outline the chart. after the contribution, it must be reviewed by the administrator. in this way, the basic usage plan is complete, the following describes the field planning. To introduce a book, we plan the following content: The puppet publish single-line text (varchar) publication time pubtime time type number of words cnum integer type number of times pubnum integer type page count pagenum integer type printing time pritime time type open kbook single line text (varchar) printed prinum integer type sheets of pages single line text (varchar) I s B Nisbn single line text (varchar) package packs single line text (varchar) content overview body HTML text author introduction wrbody HTML text directory bindex HTML text so that we have completed the first step of model planning.
   Model creationAfter the planning is completed, we will start to create the content of the planning as a content model. First, log on to the system background as a super administrator. Click [core]-[Model Management] and click "Add model" to create a model. Follow the system prompts to configure the basic information of the model. because the automatic model is selected here, you only need to retain the default settings on the file publishing render ER page. Because we published a book, the "name used for the title of the contribution" is set to "name of the book.

Because we use an automatic model and do not have a corresponding release management program, we can keep the following model release programs by default. of course, if you have certain programming capabilities, you can create a content publishing program and specify it here.

After setting the basic information, click OK to go to the field management page. click "add new field" in field management to go to the field addition page, we add fields based on the relevant field information. Some fields are described as follows: Single-line text (varchar): Common fields, such as the title and author of an article, are text that is directly entered with a small amount of content. after this text is set, you must specify the text length. the default value is 250. if it is greater than 255, it is of the text type. Multi-line text: It is also a common field type, such as personal profile and product description, which can be stored using multi-line text HTML Text: Use the Zhimeng editor to edit the generated html content for complicated content formats. Attachment type: Attachments can be uploaded in the background for users to download. attachment types can be set in the background. Option Drop-down list: Select from the drop-down list. it is generally used for fields such as software type and language type. Linkage type: A data type in the form of an array. you can set it in the system background Association type management. after understanding these field types, we can add our field information.

Click "OK" to complete the creation of the model. After the model is added, we find that there is an additional option for publishing books at the place where the content is released. This indicates that our model has been successfully added.

Template creationWe learned from the main template file and function description in the Zhimeng help center that each model also needs to create a corresponding model template file, you can view the template file through the template file description in the background Model Management.

There are two main scenarios for template creation.
The 1. page template list_ identifies id).htm and is displayed in the list. to add extended fields, you must select "enable fields to be obtained from the underlying template of the list" on the add field page. by default, custom fields can only be displayed in the document template., enabling this option slows down the list query. if you do not need to select this option, you can use [field: fieldname. 2. the tag on the content page can be called using {dede: field. fieldname/}. for details, refer to the help documentation related to the Help Center template.
   Topic settingsNext, we can add a topic and set the content model of the topic as a book in the topic settings.

Then we can add a document under this topic, and we will find that we can now publish the book content.

  

After adding the model, you can browse our website page to preview the model effect.

  

So far, we have completed the creation of the entire model, and the entire process is very simple. Here we only introduce the creation of automatic models. of course, users with certain PHP Basics can develop their own system models. This gives them a more powerful dream system and richer website content.


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.