Asp simple static generation method (template tag replacement)

Source: Internet
Author: User

CreateHtml
Generate all articles with high resource usage
Method 1: Copy codeThe Code is as follows: 'start HTML Generation Method
Set Rs = Server. Createobject ("Adodb. Recordset ")
SQL = "Select KQIQI_ID, KQIQI_Title, KQIQI_Pinyin, KQIQI_Explain, KQIQI_Content, KQIQI_Record From KQIQI_CY Order By kqiqiqi_id Desc"
Rs. Open SQL, Conn, 1, 3
Datanum = Rs. Recordcount
For I = 1 To Datanum
Title = Replace (Rs (1), Chr (13), ""), Chr (10 ),"")
'Start generating the idiom File
Set Fso = Createobject ("Scripting. FilesyStemobject ")
Set KQIQI_MB = Fso. Opentextfile (server. mappath ("KQIQI_CY_MB.html "))
KQIQI_Ce = KQIQI_MB.readall
KQIQI_MB.close
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Title}", "" & Title &"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: SystemTitle}", "" & SystemTitle &"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Pinyin}", "" & Rs (2 )&"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Explain}", "" & Rs (3 )&"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Content}", "" & Rs (4 )&"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Record}", "" & Rs (5 )&"")
Set KQIQI_We = Fso. Createtextfile (Server. Mappath ("Html/KQIQICY _" & Rs (0) & ". html"), true)
KQIQI_We.writeline KQIQI_Ce
KQIQI_We.Close
Set Fso = Nothing
'Generation complete
Rs. Movenext
Next
KQIQICY = KQIQICY & "<TABLE cellSpacing =" 0 "" cellPadding = "0" "width =" 480 "" align = "center" "border =" 0 """ class = "" td table ""> "& vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center"> </TD> </TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center" "class =" "tdbar" "> generation completed </TD> </TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center" "> all the kqiqi idiom dictionaries have been generated! <Input type = "" button "" name = "" button1 "" value = "" return "" onclick = "" javascript: history. back (-1); ""> </TD> </TR> "& vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center" "class =" "tdbar" "> quit </TD> </TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center" "> <a href =" "KQIQI_Admin.asp? Action = Quit ""> Quit </a> "& vbCrLf
KQIQICY = KQIQICY & "</TD> </TR> </FORM> </TABLE>" & vbCrLf

Second, we can see from other systemsCopy codeThe Code is as follows: <%
'Copyright 2007
'Prepared by: Wu Jun
'Copyright: www.sm05.com
'Version: Ver 1.0
'Technical support: Mail: service@sm05.com QQ: 21275120
%>
<! -- # Include file = "cyconn. asp" -->
<%
Dim fso
Dim fr
Dim wstr
Dim fw
'Start HTML Generation Method
Set rs = server. createobject ("adodb. recordset ")
SQL = "select * from pic order by id desc"
Rs. open SQL, conn, 1, 3
Datanum = rs. recordcount
For I = 1 to datanum
'Start generating the idiom File
Set fso = createobject ("scripting. filesystemobject ")
Set fr = fso. opentextfile (server. mappath ("chengyu_m.htm "))
Wstr = fr. readall
Fr. close
Dim rstr
Wstr = replace (wstr, "<{biaoti}>", "" & replace (rs ("biaoti"), vbnewline ,"")&"")
Wstr = replace (wstr, "<{pinyin}>", "" & rs ("sg ")&"")
Wstr = replace (wstr, "<{jieshi}>", "" & rs ("js ")&"")
Wstr = replace (wstr, "<{from}>", "" & rs ("content ")&"")
Wstr = replace (wstr, "<{example}>", "" & rs ("jilu ")&"")
Set fw = fso. createtextfile (server. mappath ("view/chengyu" & rs ("id") & ". htm"), true)
Fw. writeline wstr
Fw. close
Set fso = nothing
'Generation complete
Rs. movenext
Next
Response. write "to generate all Forum idioms! "
%>

MakeHtml is generated from the specified idCopy codeThe Code is as follows: 'start HTML Generation Method
Set Rs = Server. Createobject ("Adodb. Recordset ")
SQL = "Select KQIQI_ID, KQIQI_Title, KQIQI_Pinyin, KQIQI_Explain, KQIQI_Content, KQIQI_Record From KQIQI_CY Order By kqiqiqi_id Desc"
Rs. Open SQL, Conn, 1, 3
For I = id1 To id2
Title = Replace (Rs (1), Chr (13), ""), Chr (10 ),"")
'Start generating the idiom File
Set Fso = Createobject ("Scripting. FilesyStemobject ")
Set KQIQI_MB = Fso. Opentextfile (server. mappath ("KQIQI_CY_MB.html "))
KQIQI_Ce = KQIQI_MB.readall
KQIQI_MB.close
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Title}", "" & Title &"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: SystemTitle}", "" & SystemTitle &"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Pinyin}", "" & Rs (2 )&"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Explain}", "" & Rs (3 )&"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Content}", "" & Rs (4 )&"")
KQIQI_Ce = Replace (KQIQI_Ce, "{$ KQIQI: Record}", "" & Rs (5 )&"")
Set KQIQI_We = Fso. Createtextfile (Server. Mappath ("Html/KQIQICY _" & Rs (0) & ". html"), true)
KQIQI_We.writeline KQIQI_Ce
KQIQI_We.Close
Set Fso = Nothing
'Generation complete
Rs. Movenext
Next
KQIQICY = KQIQICY & "<TABLE cellSpacing =" 0 "" cellPadding = "0" "width =" 480 "" align = "center" "border =" 0 """ class = "" td table ""> "& vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center"> </TD> </TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center" "class =" "tdbar" "> generation completed </TD> </TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center" "> the kqiqi idiom dictionary is generated! <Input type = "" button "" name = "" button1 "" value = "" return "" onclick = "" javascript: history. back (-1); ""> </TD> </TR> "& vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center" "class =" "tdbar" "> quit </TD> </TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR> <TD align =" "center" "> <a href =" "KQIQI_Admin.asp? Action = Quit ""> Quit </a> "& vbCrLf
KQIQICY = KQIQICY & "</TD> </TR> </FORM> </TABLE>" & vbCrLf

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.