时间:2021-05-28
CreateHtml
所有文章生成,好用资源大
第一种方法:
复制代码 代码如下:
'开始HTML生成方式
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),"")
'开始生成成语文件
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
'生成完成
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"">生成完毕</TD></TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR><TD align=""center"">客齐齐成语词典全部生成完毕!<input type=""button"" name=""button1""value=""返回"" onclick=""javascript:history.back(-1);""></TD></TR>"& vbCrLf
KQIQICY = KQIQICY & "<TR><TD align=""center"" class=""tdbar"">退出</TD></TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR><TD align=""center""><a href=""KQIQI_Admin.asp?Action=Quit"">退出</a>"& vbCrLf
KQIQICY = KQIQICY & "</TD></TR></FORM></TABLE>" & vbCrLf
第二种,从别的系统看到的
复制代码 代码如下:
<%
' Copyright 2007
' 编写者:吴军
' 版权所有: QQ: 21275120
%>
<!--#include file="cyconn.asp"-->
<%
dim fso
dim fr
dim wstr
dim fw
'开始HTML生成方式
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
'开始生成成语文件
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
'生成完成
rs.movenext
next
response.write "来一来论坛 成语栏目 全部生成完毕!"
%>
MakeHtml 从指定的id开始生成
复制代码 代码如下:
'开始HTML生成方式
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),"")
'开始生成成语文件
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
'生成完成
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"">生成完毕</TD></TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR><TD align=""center"">客齐齐成语词典生成完毕!<input type=""button"" name=""button1""value=""返回"" onclick=""javascript:history.back(-1);""></TD></TR>"& vbCrLf
KQIQICY = KQIQICY & "<TR><TD align=""center"" class=""tdbar"">退出</TD></TR>" & vbCrLf
KQIQICY = KQIQICY & "<TR><TD align=""center""><a href=""KQIQI_Admin.asp?Action=Quit"">退出</a>"& vbCrLf
KQIQICY = KQIQICY & "</TD></TR></FORM></TABLE>" & vbCrLf
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
当然是可以的,而且非常简单,今天就教大家在ASP中不用模板生成HTML静态页的方法。这里假设有一个htmer.asp动态页面,你想把它生成为HTML静态页面ht
这段代码演示了php如何通过自定义的模板页面和自定义标签生成静态页面。原理非常简单,就是将模板页面中的标签替换成动态数据即可。希望能给你一定的启发。templa
生成静态页的页面非常的简单就是定义好模板与模板标题,之后利用str_replace进行替换了,是最常用的方法,另一种是利用ob_get_contents输出获得
本文实例讲述了ASP.NET静态页生成方法。分享给大家供大家参考。具体实现方法如下:一、问题:由于业务需要,得把页面按照模板页生成静态页面,所以自己就琢磨了下,
FSO生成静态HTML文件的时候替换模板标签一直是一个很麻烦的问题,至少我是这么认为的,还要别外做一个模板,麻烦!,我今天看见有一个方法可以解决这个问题如一个正