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.