asp生成html 分类列表
来源:
互联网
日期:2008-12-19
<!--#include file="../login/pwk.asp"-->
<!--#include file="../../conn/Conn.asp"-->
<!--#include file="../../conn/news_lb.asp" -->
<!--#include file="../../conn/fso.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
If(Request.QueryString("Page")="") Then
Page=1
Else
Page=Request.QueryString("Page")
Page_index=Request.QueryString("Page")
End If
lbid=request("lbid")
xlbid=request("xlbid")
SQL="Select * From news where lbid="&lbid&" and xlbid="&xlbid&" Order By ID DESC"
Set Rs = Server.CreateObject("Adodb.RecordSet")
Rs.Open SQL,Conn,1,1
dim lbid_f,xlbid_f
lbid_f=""
xlbid_f=""
lbid_f=rs("lbid")
xlbid_f=rs("xlbid")
If(Rs.EOF) Then
strList="没有内容"
Else
strlist="<table width=100% border=0 cellpadding=0 cellspacing=3>"
Rs.pagesize=25
Rs.AbsolutePage=Page
TotalPage=Rs.PageCount
For i=0 To rs.pagesize-1 '显示具体的数据内容了,i+(page*13-13)+1 这个解决分页后显示具体的编号
If Rs.eof Then Exit For
'//列表内容
strList = strList &"<tr><td height=25 valign=middle>"& i+(Page*13-13)+1 & " : <A href='/html/"&Rs("html")&"' target=_blank><span class=font_b_u>"&Rs("bt")&"</span></a> <font color=#6666CC size=0>("&rs("ly")&","&month(rs("sj"))&"月"&day(rs("sj"))&"日,"&rs("rq")&"次)</font></td></tr>"
Rs.movenext
Next
strList = strList&"</table>"
If(Int(Page)=1) Then
PageFirst="[首页"
Else
PageFirst="[<a href=""Index_1.html"">首页</a>"
End If
If(Int(Page)=1)Then
PageBack=" 上一页 "
Else
PageBack=" <a href=""Index_"&Page-1&".html"">上一页</a> "
End If
If(Int(Page)=TotalPage)Then
PageNext=" 下一页 "
Else
PageNext=" <a href=""Index_"&Page+1&".html"">下一页</a> "
End If
If(Int(Page)=TotalPage)Then
PageLast="尾页]"
Else
PageLast="<a href=""Index_"&TotalPage&".html"">尾页</a>]"
End If
AbsPage=" 第 <select onchange=""window.location='Index_'+this.options[this.selectedIndex].value+'.html'"">"
For j=1 To TotalPage
AbsPage=AbsPage&"<option value="&j
If(Cstr(j)=Cstr(Page))Then
AbsPage=AbsPage&" selected"
End If
AbsPage=AbsPage&">"&j&"</option>"
Next
AbsPage=AbsPage&"</select> 页"
'//连接分页导航
PageNav=PageFirst&PageBack&PageNext&PageLast&AbsPage
End If
'//所在位置
listwz="您的位置: <a href=/shop/index.asp><font color=#FFFFFF>首页</font></a> >> <span class=link_u>"&news_lb(request("lbid"),0)&"</span> >> <span class=link_u>"&replace(news_lb(request("lbid"),xlbid_f),",","")&"</span>"
title=my_name&" -"&news_lb(request("lbid"),0)&"-"&replace(news_lb(request("lbid"),xlbid_f),",","")
wz_lb=replace(news_lb(request("lbid"),xlbid_f),",","")
'//生成文件夹
Dim lbFSO
Set lbFSO = Server.CreateObject("Scripting.FileSystemObject")
If lbFSO.FolderExists(Server.MapPath("\html\index\"&lbid_f&"")) Then
Else
lbFSO.CreateFolder(Server.MapPath("\html\index\"&lbid_f&""))
End If
Set lbFSO = Nothing
Dim xlbFSO
Set xlbFSO = Server.CreateObject("Scripting.FileSystemObject")
If xlbFSO.FolderExists(Server.MapPath("\html\index\"&lbid_f&"\"&xlbid_f&"")) Then
Else
xlbFSO.CreateFolder(Server.MapPath("\html\index\"&lbid_f&"\"&xlbid_f&""))
End If
Set xlbFSO = Nothing
'//文件夹生成结束
'//生成列表文件
TempContent=Conn.Execute("Select demo From news_demo Where ID=2")(0)'//获取模板
TempContent=replace(TempContent,"$ArticleList$",strList)'//替换模板内容
TempContent=replace(TempContent,"$PageNav$",PageNav)
TempContent=replace(TempContent,"$listwz$",listwz)
TempContent=replace(TempContent,"$title$",title)
TempContent=replace(TempContent,"$wz_lb$",wz_lb)
'Set FSO = Server.CreateObject("Scripting.FileSystemObject")
'Set Fout = FSO.CreateTextFile(Server.MapPath("\html\index\"&rs("lbid")&"\"&rs("xlbid")&"\Index_"&Page&".html"))
'Fout.Write TempContent
'Fout.Close
'//注意lbid_f的地址,容易出错!
wj="../../html/index/"&lbid_f&"/"&xlbid_f&"/Index_"&Page&".html"
nr=TempContent
shencheng wj,nr
'//生成列表文件结束
%>
<%If(Int(Page)<Int(TotalPage))Then%>
<html>
<head><title>完成</title>
<meta http-equiv="refresh" content="0;url=slbhtml.asp?Page=<%=Page+1%>&lbid=<%=lbid%>&xlbid=<%=xlbid%>">
</head>
<body>
第<font color=red><b><%=Page%></b></font>页生成完毕!
</body>
</html>
<%Else
response.Write "<script language='javascript'>alert('生成文章分类完毕,共生成["&TotalPage&"]页!');window.location.href='lb_gl.asp';</script>"
response.End
End If
%> 该文章转载自[弹指科技-www.make-web.cn
更多的asp生成html 分类列表请到论坛查看: http://BBS.TC711.COM
【 双击滚屏 】 【 评论 】 【 收藏 】 【 打印 】 【 关闭 】
来源:
互联网
日期:2008-12-19
|
|
|