Beginner ASP, the program can be barely written, but if every website page is revised, all source transplants will be performed. If you consume a lot of human energy, even if you don't pay attention, you will abandon it.
So, dreaming that the program code of the large section becomes a few simple characters, so as long as the design of the page is inserted into it. In fact, this is also simple, just make the program code that implements this function into a child, and then the home page can be called.
Many times, in the blog China, you will choose a lot of templates, and you can also be designed yourself; or use pig flying blogs to change their site is not close to the same ... These are all attributed to The ASP features a template.
Then I will give a Buddha to give the template to give a group of friends.
First, the template needs to be modified online, then the database saves template code should be used.
The so-called template is the standard HTML code for design and completed.
The functional part implemented by the program will adopt
Special string instead. However, these special strings need to be compiled as a corresponding function when displayed.
1. Design Database Testmb.mdb
New Table Moban: Field M_ID (Auto Number, Lord Keyword); Field M_HTML (Remark Type)
2, assume the first template content code
Copy the following code to the m_html field
testmb title> head>
$ cntop $ td> tr>
$ CNRIGHT $ TD> TR> table> body> html>
Note $ CNTOP $, $ CNLEFT $, $ CNRIGHT $, which will implement some specific programs
3, establish a database connection file Conn.asp
<% set conn = server.createObject ("adoDb.connection") connStr = "provider = microsoft.jet.Oledb.4.0; data source =" & Server.mappath ("testmb.mdb") Conn.open connStr%> 4, Establish a special string conversion required to lib.asp
The main role of this document is to make the ASP program that implements some functions to make a word program to facilitate calls.
<% Dim topcodesub cntop () topcode = "current time is:" topcode = topcode & now () end subdim leftcode, isub cnleft () for i = 1 to 5 leftcode = leftcode & "
cnbruce.com" nextend subdim rightcodesub cnright ( ) For i = 1 to 9 rightcode = rightcode & "
5. Finally, call the template code in the database to convert special strings.
This page main function is to display the template code and convert the special code in which the special code is functional.
At this point, the template function of the ASP is basically completed, and the rest is: establish a program page with editing template function, change the library file to its own program function ...