asp简单生成静态的方法(模板标签替换)
程序员文章站
2022-08-05 20:42:20
createhtml所有文章生成,好用资源大 第一种方法:复制代码 代码如下: '开始html生成方式 set rs=server.createobject("adodb....
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
' 编写者:吴军
' 版权所有:www.sm05.com
' 版本:ver 1.0
' 技术支持:邮件:service@sm05.com 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
所有文章生成,好用资源大
第一种方法:
复制代码 代码如下:
'开始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
' 编写者:吴军
' 版权所有:www.sm05.com
' 版本:ver 1.0
' 技术支持:邮件:service@sm05.com 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
上一篇: 判断字符串中单词个数(C++实现)
下一篇: 【原】iOS查找私有API