A simple way to generate static asp. Today I looked at the code in the dictionary tool. It is relatively simple. Friends who need it can refer to it. CreateHtml
All articles are generated, easy to use resources
First method:
Copy the code code as follows:
'Start HTML generation mode
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 KQIQI_ID Desc
Rs.Open Sql,Conn,1,3
Datanum=Rs.Recordcount
For i= 1 To Datanum
Title=Replace(Replace(Rs(1),Chr(13),),Chr(10),)
'Start generating idiom files
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 completed
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><IMG src=images/logo.gif border=0 width=220 height=90></TD></TR> & vbCrLf
KQIQICY = KQIQICY & <TR><TD align=center class=tdbar>Generated</TD></TR> & vbCrLf
KQIQICY = KQIQICY & <TR><TD align=center>Ke Qiqi idiom dictionary has been generated! <input type=button name=button1value=return onclick=javascript:history.back(-1);></TD></TR>& vbCrLf
KQIQICY = KQIQICY & <TR><TD align=center class=tdbar>Exit</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
The second type is seen from other systems.
Copy the code code as follows:
<%
'Copyright 2007
'Written by: Wu Jun
' Copyright: www.sm05.com
'Version: Ver 1.0
'Technical support: Email: [email protected] QQ: 21275120
%>
<!--#include file=cyconn.asp-->
<%
dim fso
dim fr
dim wstr
fw
'Start HTML generation mode
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 idiom files
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 completed
rs.movenext
next
response.write Come on, all the idiom columns of the forum have been generated!
%>
MakeHtml is generated starting from the specified id
Copy the code code as follows:
'Start HTML generation mode
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 KQIQI_ID Desc
Rs.Open Sql,Conn,1,3
For i=id1 To id2
Title=Replace(Replace(Rs(1),Chr(13),),Chr(10),)
'Start generating idiom files
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 completed
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><IMG src=images/logo.gif border=0 width=220 height=90></TD></TR> & vbCrLf
KQIQICY = KQIQICY & <TR><TD align=center class=tdbar>Generated</TD></TR> & vbCrLf
KQIQICY = KQIQICY & <TR><TD align=center>Ke Qiqi idiom dictionary has been generated! <input type=button name=button1value=return onclick=javascript:history.back(-1);></TD></TR>& vbCrLf
KQIQICY = KQIQICY & <TR><TD align=center class=tdbar>Exit</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