加入收藏 | 设为首页 | 会员中心 | 我要投稿 衡阳站长网 (https://www.0734zz.cn/)- 数据集成、设备管理、备份、数据加密、智能搜索!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

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

发布时间:2020-12-24 15:11:12 所属栏目:Asp教程 来源:网络整理
导读: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]

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

(编辑:衡阳站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读