Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
When ASP is a beginner, the program can barely be written. However, every time a website page is revised, all source programs will be transplanted. The amount of manpower and energy it consumes is countless, and even the loss is not worth the candle.
Therefore, I dreamed that the code of a large program would be replaced by a few simple characters, so as long as the page is designed to insert this function, it will be OK. In fact, this is also simple. You only need to make the program code that implements this function into a subroutine, and then call the home page.
Many times, in blog China, you may choose many templates or even design them by yourself; or the webmasters who use the pig Feifei BLOG have changed their sites not nearly the same ...... All of these are attributed to ASP's use of the template function.
Now, let's take a look at the template and analyze it to feed your friends.
First, if the template needs to be modified online, the database should be used to save the template code.
The so-called template is the standard HTML code designed to be completed. The Function part that needs to be implemented by the program will be replaced by a special string. However, these special strings must be compiled into corresponding functions during display.
1. Design the database testmb. mdb
Create a table moban: field m_id (automatic number, primary keyword); field m_html (remarks type)
2. Assume that the content code of the first template is
Copy the following code to the m_html field.
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> testmb </title>
<Body leftmargin = "0" topmargin = "0">
<Table width = "100%" height = "100%" border = "0" cellpadding = "5" cellspacing = "2">
<Tr align = "right" bgcolor = "# CCCCCC">
<Td height = "20" colspan = "2"> $ cntop $ </td>
<Tr valign = "top">
<Td width = "25%" bgcolor = "# e5e5e5"> $ cnleft $ </td>
<Td width = "74%" bgcolor = "# f3f3f3"> $ cnright $ </td>
Note $ cntop $, $ cnleft $, and $ cnright $. They will implement certain program functions.
3. Create the database connection file conn. asp
Set conn = Server. CreateObject ("ADODB. Connection ")
Connstr = "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & Server. MapPath ("testmb. mdb ")
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.