一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

asp生成静态页面源码

时间:2010-08-18 编辑:简简单单 来源:一聚教程网

 代码如下 复制代码

'以下为批量生成程序
if request("type") = "update" then%>
<%
set ru=server.createobject("adodb.recordset")
sql="select * from news where id >= "&request("b_id")&" and id <= "&request("e_id")&" order by id desc"
ru.open sql,conn,1
do while not ru.bof and not ru.eof %>
<%
okfile=fsow("../dnshow.html")
file1=server.mappath("../html")
dim newsfile
if vartype(ru("file_name")) = 1 then
newsfile = year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&""&ru("id")&".html"
else
newsfile = ru("file_name")
end if
file2=file1&""&newsfile
id = ru("id")
if vartype(ru("infotime")) = 1 then
infotime = date()
else
infotime = ru("infotime")
end if
okfile = replace(okfile,"id",id)
okfile = replace(okfile,"title",ru("title"))
okfile = replace(okfile,"content",ru("content"))
okfile = replace(okfile,"infotime",infotime)
set fso = server.createobject("scripting.filesystemobject")
set fout = fso.createtextfile(file2,true)
fout.writeline okfile
fout.close
sql="update news set file_name = '"&newsfile&"',infotime = '"&infotime&"' where id = "&ru("id")
conn.execute(sql)
%>
<%=file2%>生成成功....


<%
ru.movenext
loop
%><%end if%>

 

热门栏目