ASP Application Template adoption

Source: Internet
Author: User
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.
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> testmb </title>
</Head>
<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>
<Tr valign = "top">
<Td width = "25%" bgcolor = "# e5e5e5"> $ cnleft $ </td>
<Td width = "74%" bgcolor = "# f3f3f3"> $ cnright $ </td>
</Tr>
</Table>
</Body>
</Html>

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 ")
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.