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

set rsn=server.CreateObject(adodb.recordset)sqln=select top 1 * from vArticle where apage=abnamersn.open sqln,conn,1,1if not rsn.eof thendo while not rsn.eofpage_n=len(rsn(aContent))-len(replace(rsn(aContent),[NextPage],))page_n=split(rsn(a

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

作者: dawei

【声明】:永州站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部