Niuyun news publishing system (iii) -- master and niuyun news publishing system --

Source: Internet
Author: User

Niuyun news publishing system (iii) -- master and niuyun news publishing system --


In the process of making a webpage, there will always be many places that do not change much, but they are repeated.

Therefore, the introduction of the master concept is good. Write a master in a repeated place, and then other pages can implement the same function as long as they are referenced, and the page code will be much reduced.

For example, if I write a demo

This is a simple web page for browsing Ancient Poetry


I don't want to change the headers and tails. For example, the headers and bottom are the most frequently used parts of web pages. If I have a lot of web pages and these pages are all the same, I can't create them again. Here we use the object-oriented ideology-Abstraction-master page. Place the head and bottom parts on the master page. If other pages reference the master page, you do not need to write the same functions again.

Code before modification:

<% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "WebForm1.aspx. cs" Inherits = "WebApplication1.WebForm1" %> <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

Code after modification:

Master page:

<% @ Master Language = "C #" AutoEventWireup = "true" CodeBehind = "Site1.master. cs" Inherits = "WebApplication1.Site1" %> <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

Effect:


With this dashboard page, the flexible web page starts the first step.

I will omit the code and effects of the Content Page. Similar.








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.