超长文章分页并生成静态页实例

超长文章分页并生成静态页实例,第1张

概述set rsn=server.CreateObject("adodb.recordset")sqln="select top 1 * from vArticle where apage='"&abname&"'"rsn.open sqln,conn,1,1if not rsn.eof then'do while not rsn.eof'page_n=len(rsn("aContent"))-len(replace(rsn("aContent"),"[NextPage]",""))page_n=split(rsn("aContent"),"[NextPage]")for i=1 to Ubound(page_n)+1set rs=server.CreateObject("adodb.recordset")sql="select * from hy_moban where mname='资讯内页'"rs.open sql,conn,1,1okfile=rs("mcontent")rs.closeset rs=nothing'if i=1 then 'ppage=1 'else 'ppage=i-1 'end if 'if i=1 and page_n+1>i then 'npage=i+1 'else 'npage=page_n+1 'end ifaFrom=split(rsn("aFrom")&"|","|")if aFrom(0)="" thennaFrom="未知"elsenaFrom=aFrom(0)end ifk=i-1Ntitle=rsn("aTitle")&"|"&rsn("akeyword")okfile=replace(okfile,"$Ntitle$",Ntitle)okfile=replace(okfile,"$C_Title$",rsn("C_Title"))okfile=replace(okfile,"$aTitle$",rsn("aTitle"))okfile=replace(okfile,"$acount$",rsn("acount"))okfile=replace(okfile,"$aIntime$",rsn("aIntime"))okfile=replace(okfile,"$aFrom$",naFrom)okfile=replace(okfile,"$aContent$",page_n(k))okfile=replace(okfile,"$aInUser$",rsn("aInUser"))apage=replace(rsn("apage"),".shtml","")asetpage=""for j=1 to Ubound(page_n)+1if j=i thenasetpage=asetpage&"[<font color=red>"&i&"</font>]"elseif j=1 thenasetpage=asetpage&"[<a href="&rsn("apage")&">"&j&"</a>]"elseasetpage=asetpage&"[<a href="&apage&"-haowai-"&j&".shtml>"&j&"</a>]"end ifnext'asetpage="<br><a href="""&apage&"_"&ppage&".shtml"">上一页</a> <a href="""&apage&"_"&npage&".shtml"">下一页</a>"okfile=replace(okfile,"$aSetpage$",asetpage)myear=year(rsn("aInTime"))&"-"&month(rsn("aInTime"))if i=1 thenmypage=rsn("apage")elsemypage=apage&"-haowai-"&i&".shtml"end ifSet fso1 = Server.CreateObject("Scripting.FileSystemObject")  Set fout1 = fso1.Createtextfile(Server.MapPath("/"&"article/"&myear&"/"&mypage),true) fout1.writeline okfilefout1.close'rsn.movenext'loopnextend ifrsn.closeset rsn=nothing

sqln="select top 1 * from vArticle where apage='"&abname&"'"
rsn.open sqln,conn,1,1
if not rsn.eof then
'do while not rsn.eof
'page_n=len(rsn("aContent"))-len(replace(rsn("aContent"),"[NextPage]",""))
page_n=split(rsn("aContent"),"[NextPage]")
for i=1 to Ubound(page_n)+1

sql="select * from hy_moban where mname='资讯内页'"
rs.open sql,1
okfile=rs("mcontent")
rs.close
set rs=nothing
'if i=1 then 
'ppage=1 
'else 
'ppage=i-1 
'end if 
'if i=1 and page_n+1>i then 
'npage=i+1 
'else 
'npage=page_n+1 
'end if
aFrom=split(rsn("aFrom")&"|","|")
if aFrom(0)="" then
naFrom="未知"
else
naFrom=aFrom(0)
end if
k=i-1
NTitle=rsn("aTitle")&"|"&rsn("akeyword")
okfile=replace(okfile,"$NTitle$",NTitle)
okfile=replace(okfile,"$C_Title$",rsn("C_Title"))
okfile=replace(okfile,"$aTitle$",rsn("aTitle"))
okfile=replace(okfile,"$acount$",rsn("acount"))
okfile=replace(okfile,"$aIntime$",rsn("aIntime"))
okfile=replace(okfile,"$aFrom$",naFrom)
okfile=replace(okfile,"$aContent$",page_n(k))
okfile=replace(okfile,"$aInUser$",rsn("aInUser"))
apage=replace(rsn("apage"),".sHTML","")
asetpage=""
for j=1 to Ubound(page_n)+1
if j=i then
asetpage=asetpage&"["&i&"]"
elseif j=1 then
asetpage=asetpage&"[]"
else
asetpage=asetpage&"["&j&"]"
end if
next
'asetpage="
"
okfile=replace(okfile,"$aSetpage$",asetpage)
myear=year(rsn("aInTime"))&"-"&month(rsn("aInTime"))
if i=1 then
mypage=rsn("apage")
else
mypage=apage&"-haowai-"&i&".sHTML"
end if
Set fso1 = Server.CreateObject("Scripting.fileSystemObject")
  Set fout1 = fso1.Createtextfile(Server.MapPath("/"&"article/"&myear&"/"&mypage),true)
 fout1.writeline okfile
fout1.close
'rsn.movenext
'loop
next
end if
rsn.close
set rsn=nothing

总结

以上是内存溢出为你收集整理的超长文章分页并生成静态实例全部内容,希望文章能够帮你解决超长文章分页并生成静态页实例所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1220209.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存