您的位置:首页 > Web前端 > HTML

生成HTML页面代码

2005-08-31 21:03 369 查看
<!--#include file="../inc/connnews_fso.asp"-->
<%dim fso,tmp,rs,sql,sclassid,sclass,pagename,nexts,alls,Nclassid
if request("page")<>"" then
if cint(request("page"))<1 then
currentPage=1
application("load_special")=""
else
currentPage=cint(request("page"))
end if
else
currentPage=1
application("load_special")=""
end if
nexts=request("next")
alls=request("all")
Nclassid=request("Nclassid")
response.write "开始生成文章"
Set fso = CreateObject("Scripting.FileSystemObject")
if application("load_special")<>"ok" then
tmp = Server.MapPath("shownews.html")
Set tmp = fso.OpenTextFile(tmp)
DO While not tmp.AtEndOfStream
application("t_special")=tmp.ReadAll
Loop
tmp.close
set tmp=nothing
application("load_special")="ok"
end if
newsid=request.QueryString("newsid")
set rs = Server.CreateObject("ADODB.Recordset")
MaxPerPage=1
if alls="page" then
sql="select newsid,title,content,typeid,weblink,Nfrom,Dateandtime from News where recycle=1 and newsid="&newsid&" order by newsid desc"
else
sql="select newsid,title,content,typeid,weblink,Nfrom,Dateandtime from News where recycle=1 order by newsid desc"
end if
rs.open sql,conn,1,1
rs.pagesize=MaxPerPage
mpage=rs.pagecount '得到总页数
rs.move (currentPage-1)*MaxPerPage
if not rs.eof then
newsid=rs("newsid")
title=rs("title")
Content=rs("Content")
typeid=rs("typeid")
weblink=trim(rs("weblink"))
Nfrom=rs("Nfrom")
Dateandtime=rs("Dateandtime")
end if
rs.close
response.write "<br>已生成/要生成页数:<font color=#FF0000>"¤tPage-1&"</font>/<font color=#FF0000><b>"&mpage&"</b></font>个,"
if mpage<currentPage then
response.write "操作完成!"
if alls="page" and nexts="" then%>
<script LANGUAGE="JavaScript">
<!--
setTimeout('window.close();', 500);
// -->
</script>
<%elseif alls="page" and nexts="singer" and Nclassid<>"" then
response.write "<meta http-equiv=Refresh content='0; URL=fso_news.asp?all=page&Nclassid="&Nclassid&"'>"
end if
else
sql="select typeid,type from NewsType where typeid="&cstr(typeid)
rs.open sql,conn,1,1
typena=rs("type")
rs.close
sql="select top 1 * from news where recycle=1 and typeid="&typeid&" and newsid>"&newsid&" order by newsid asc "
rs.open sql,conn,1,1
if rs.eof and rs.bof then
titleup="暂未收录"
else
newsidup=rs("newsid")
titleupto=rs("title")
weblinkup=trim(rs("weblink"))
titleup="<a href='../../"&weblinkup&"'>"&titleupto&"</a>"
end if
rs.close
sql="select top 1 * from news where recycle=1 and typeid="&typeid&" and newsid<"&newsid&" order by newsid desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
titlenext="暂未收录"
else
newsidnext=rs("newsid")
titlenextto=rs("title")
weblinknext=trim(rs("weblink"))
titlenext="<a href='../../"&weblinknext&"'>"&titlenextto&"</a>"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
pencat=application("t_special")
pencat=replace(pencat,"{title}",title)
pencat=replace(pencat,"{typena}",typena)
pencat=replace(pencat,"{typeid}",typeid)
pencat=replace(pencat,"{Nfrom}",Nfrom)
pencat=replace(pencat,"{dateandtime}",dateandtime)
pencat=replace(pencat,"{content}",content)
pencat=replace(pencat,"{titleup}",titleup)
pencat=replace(pencat,"{titlenext}",titlenext)
pencat=replace(pencat,"{newsid}",newsid)
setf = Server.MapPath("../"&weblink&"")
'Set setf = fso.OpenTextFile(setf)
Set setf = fso.OpenTextFile(setf,2,True)
Setf.WriteLine pencat
response.write "<meta http-equiv=Refresh content='0; URL=fso_news.asp?all="&alls&"&newsid="&newsid&"&next="&nexts&"&Nclassid="&Nclassid&"&page="¤tPage+1&"'>"
response.end
end if
%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: