生成HTML页面代码

<!--#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>"&currentPage-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="&currentPage+1&"'>"
  response.end
end if
%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值