DTCMS plug-in production instance electronic resource management (3) Front-end template page writing, dtcms Electronic Resources

Source: Internet
Author: User
Tags what parameter

DTCMS plug-in production instance electronic resource management (3) Front-end template page writing, dtcms Electronic Resources
Total directory

  • Plug-in directory structure (1)
  • Admin background page (2)
  • Foreground template page writing (3)
  • URL rewriting (4)

    This example is intended to show you how to create a plug-in dtcms using an example in an actual project. This series of articles is not an introductory tutorial, but part of the logic has been implemented.

Two years later, I received a reply from this article again. I am ashamed that this series ended in Chapter 2. I did not look for reasons from the outside. Since I found my shortcomings, it must be because I did not write well enough and it must be too utilitarian. So I decided to return to the Tutorial at that time, complete the series after two years.

Contents of this Chapter
  • Preparation of the foreground template page
  • Front-end template page data provision

I. Compiling the 1.1 List page on the front-end template page

First, create a database_list.html file under templetin the plug-in directory.

The content of the file is to make a list page. Except for head and footer, we want to make the middle part look like this. Because we are not a preliminary tutorial, We will skip the process of making and designing a large number of css pages here. We can directly copy html content to the news list page, we only need to modify several of them. For example, we need to implement a navigation part by ourselves. We can use ul> li and some css to implement it. We will not expand it here. The following single database is similar to the abstract part of the news. The category on the right is the same as the category on the right of the News list page. The two images are the same in comparison.

Certificate ----------------------------------------------------------------------------------------------------------------------------------

Therefore, we can make a rough html framework. head and footer are copied, and the right side is also copied. The main modification is the div class = "main_L" on the left.

Certificate ----------------------------------------------------------------------------------------------------------------------------------

Next, we will analyze the structure on the left. In the above two filtering boxes, the following is a summary list of ul> li, and the bottom is a page. The discovery page is a ready-made summary list, which is similar to the news section.

Because the filter box also obtains the cyclic display of data, and the list part also obtains the cyclic display of data, we will use the UL list section to explain

1.2 Details page

After the list page is completed, we will make the details page again. The details page is basically the same as the news details page. If you copy the page and change it slightly, it will be OK, which is easier than the list page. This is not demonstrated here.

Ii. Provision of front-end page Data 2.1 associate front-end html and backend cs code through URL Configuration

Remember that in section 1, we skipped a large part of the configuration file, the URL rewrite? Here we will briefly introduce a part in advance, that is, the ing between the url and the background code. Here, to avoid interfering with the information, I erased the rest, mainly focusing on the rewrite part. Name is the Name of this page. It cannot be repeated with other rewriting methods. There can be several enumeration types in "type". "list" indicates the list page, and "details" indicates the details page. Others are rarely used. Page indicates the generated file name, because the DTCMS template engine works by generating the aspx file and storing it in the directory. The page must end with the aspx file. Inherit is our highlight here: The namespace of the backend cs code associated with html. Templet is the template page of this page. So we know that the association between html and cs is in the configuration file. That is, as shown in the following figure.

2.2 data provision Methods

Therefore, the data retrieval methods we write on the template page are actually written in this file.

<% Set List <LibCMS. Domain. Stat. DataBase> dbList = FindListByPropertty (out pagelist) %>

Bytes --------------------------------------------------------------------------------------

How to write this file? We still need to find the link. Isn't there a list page for the link? We copied it and changed it. Therefore, the entire cs file does not have many lines of code. You only need to write a method to obtain data. Note all the defined attributes on this page, such as page, totalcount, and pagesize. protected variables can be used directly on the template page, therefore, you can put any value to be passed here, and then use it directly on the html page when initializing through ShoPage.

So far, we have completed a complete set of work for obtaining data on the template page and template page at the front end. In fact, if there is no paging, no filtering, and no parameters, the page will be ready. But in fact, the problem we encountered is always more complicated than we thought. What we have not considered here is the parameter transfer problem. How can we obtain parameters on the background page? What parameter transfer methods does dtcms provide for us? In the next section, we will continue with the url rewriting section.

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.