| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 383 人关注过本帖
标题:求高手解决下列表分页问题
只看楼主 加入收藏
liaming
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-9-2
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
求高手解决下列表分页问题
按年度分类列表页 指定数字20 只能生成一页 数字多少都是一页,比如2010年一页 2011年的一页 如何把多出20的if i>=20生成下一页呢
<%Admin="DownMake"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>年度分类</title>
<style>
body{font-size:12pt;line-height:140%}
</style>
</head>
<body>
<!--#include file="check.asp"-->
<!--#include file="config.asp"-->
<!--#include file="pingyin.asp"-->
<%
page=ubound(split(webDownPt,","))+1
pagepath="../year/"
JyDownNewPage=request("JyDownNewPage")
if JyDownNewPage<>"" then
%>
<!--#include file="mdb_path_down.asp"-->
<%
shu=15
if JyDownNewPage="0" then
sql="select top 20 * from down order by hits desc"
pagename=pagepath&"top_"&JyDownNewPage&""&softfile&""
title="all"
else
si=cint(JyDownNewPage)-1
if webDownLbShu<>"" then
  LBshu=split(webDownLbShu,",")
  shu=LBshu(si)
end if
if webDownPt<>"" then
  LBname=split(webDownPt,",")
  title=LBname(si)
end if
qttt="system='"&title&"'"
sql="select top 20 * from down where "&qttt&" order by hits desc"
pagename=pagepath&"top_"&JyDownNewPage&""&softfile&""
end if


set rs=server.createobject("adodb.recordset")
set rs_type=server.createobject("adodb.recordset")
'列表内容
rs.open sql,conn,1,1
if not rs.eof then
i=0
do while not rs.eof
lb=lb&"<dl class=""groupInfo clearfix""><dt></dt>"
lb=lb&"<dd><ul><li><a href=""../"&softpath&"/"&c(rs("cxn"))&""&softdir&""&rs("id")&""&softfile&"""><strong>"&rs("cxn")&"</strong></a></li>"
lb=lb&"<li>内容:"
if rs("body")<>"" then
tempstr=replace(rs("body"),"<br>","")
tempstr=replace(tempstr,"<p>","")
tempstr=replace(tempstr,"</p>","")
tempstr=replace(tempstr,"<b>","")
tempstr=replace(tempstr,"<","")
tempstr=replace(tempstr,">","")
tempstr=replace(tempstr,"/","")
tempstr=replace(tempstr,"&nbsp;","")
lb=lb&""&left(tempstr,300)&" ..."
else
lb=lb&"没有内容"
end if
lb=lb&"</li>"
lb=lb&"<li class=""playBtn""><a class=""play_icon"" href=""../"&softpath&"/"&c(rs("cxn"))&""&softdir&""&rs("id")&""&softfile&"""><span>播放</span></a></li></ul></dd></dl>"
i=i+1
if i>=20 then exit do
rs.movenext
loop
end if
rs.close
'读取模板
rs.open ("select down_web from mb"),conn,1,1
pencat=""&rs("down_web")&""
rs.close
set rs_type=nothing
set rs=nothing
conn.close
set conn=nothing
pencat=replace(pencat,"T_TITLE",title)
pencat=replace(pencat,"T_LIST",ttypelist)
pencat=replace(pencat,"T_BZTOP",bztop)
pencat=replace(pencat,"T_LB",lb)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(server.mappath(""&pagename&""))
fout.Write pencat
fout.close
Set fout=nothing
Set fso=nothing
else
if request("pageshu")<>"" then
response.write"成功:共生成[分类]页面<font color=""#FF0000"">"&request("pageshu")&"</font>个,总费时<font color=""#FF0000"">"&FormatNumber((timer()-request("D")),2)&"</font>秒,完成时间"&Now()&""
else
response.write"<b><font color=""#FF0000"">正在生成[分类]页(Html),请等待......</font></b><span id=showImport></span><IE:Download ID=""oDownload"" STYLE=""behavior:url(#default#download)"" />"
for i=0 to page
response.write"<script>function onDownloadDone(downDate){showImport.innerHTML=downDate}oDownload.startDownload('year_makesortall.asp?JyDownNewPage="&i&"',onDownloadDone)</script>"
next
response.write"<meta http-equiv=""refresh"" content=""0;url='year_makesortall.asp?pageshu="&page+1&"&d="&timer()&""">"
end if
end if
%></body></html>
请改以上的 下面的是个分类的代码,如何把下面的分页代码改到上面的内容里呀
 --------------------------------------------------------------------------------------
<%Admin="DownMake"%>
<!--#include file="check.asp"-->
<!--#include file="mdb_path_down.asp"-->
<!--#include file="pingyin.asp"-->
<!--#include file="config.asp"-->
<%
set rs=server.createobject("adodb.recordset")
rs.open ("select down_list from mb"),conn,1,1
pencat=rs("down_list")
rs.close

tid=request("tid")
currentPage=cint(request("page"))
MaxPerPage=cint(request("MaxPerPage"))
rs.open "select * from downtype where id="&tid,conn,1,1
if not rs.eof then
    ts=rs("ts")   
    tstart=rs("tstart")      
   
        TN=split(rs("tname"),"|")
        TI=split(rs("ts"), ",")
          for i = 0 to ubound(TN)-1
               if i=ubound(TN)-2 and ubound(TN)>1 then
                 TTY_id=TI(i)
                 TTY_name=TN(i)
               end if
                 all_type_top_id=TI(i)
                 all_type_name=TN(i)
thistype=thistype & "  &raquo;  <a href=""../"&softlist&"/"&TI(i)&"_1"&softfile&""">"&TN(i)&"</a>"
'thistitle=thistitle & "|"&TN(i)&""
thistitle=TN(ubound(TN)-1)
next
end if
rs.close

if tstart<>"" then '***自动转向
pencat="<meta http-equiv=""Refresh"" content=""0; URL="&tstart&"""><a href="""&tstart&""">正在进入...</a>"
else '***自动转向

sqqq=sqqq&""&tid&", "
sql="select * from downtype where ts like '"&ts&"%'"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
sqqq=sqqq&""&rs("id")&", "
rs.MoveNext
loop
end if
rs.close

''########读取下级分类
rs.open "select * from downtype where tn="&tid&" order by id",conn,1,1
if NOT rs.EOF then
TTY="NO"
Tname=all_type_name
do while NOT rs.EOF
TTNN=split(rs("tname"),"|")(rs("tj")-1)
txlist=txlist&"<li><a href=""../"&softlist&"/"&rs("id")&"_1"&softfile&""">"&TTNN&"</a></li>"
rs.MoveNext
loop
end if
rs.close
if TTY_id<>"" and TTY<>"没有" then
rs.open "select * from downtype where tn="&TTY_id&" order by id",conn,1,1
if NOT rs.EOF then
Tname=TTY_name
do while NOT rs.EOF
TTNN=split(rs("tname"),"|")(rs("tj")-1)
txlist=txlist&"<li><a href=""../"&softlist&"/"&rs("id")&"_1"&softfile&""">"&TTNN&"</a></li>"
rs.MoveNext
loop
end if
rs.close
end if

''########读取本类top10
set rs=server.CreateObject("ADODB.RecordSet")
sql="select * from down where tid in ("&sqqq&") order by hits desc"
rs.open sql,conn,1,1
if rs.eof then
txtop="<li class=""n1"">No Programmes</li>"
else
do while not rs.eof
th=th+1
txtop=txtop&"<li class=""n"&th&"""><a href=""../"&softpath&"/"&c(rs("cxn"))&""&softdir&""&rs("id")&""&softfile&""">"&left(rs("cxn"),16)&"</a></li>"
if th>=10 then exit do
rs.movenext
loop
th=0
end if
rs.close

'读取软件列表
sql="select * from down where tid in ("&sqqq&") order by date desc"
rs.open sql,conn,1,1
if rs.eof then
lb=lb&"<dl class=""groupInfo clearfix"">Sorry! No Programmes</dl>"
mpage=1
allshu=0
else
rs.pagesize=MaxPerPage '得到每页数
mpage=rs.pagecount     '得到总页数
rs.move  (currentPage-1)*MaxPerPage
allshu=rs.recordcount
h=0
do while not rs.eof
h=h+1
lb=lb&"<dl class=""groupInfo clearfix"">"
lb=lb&"<dd><ul><li><a href=""../"&softpath&"/"&c(rs("cxn"))&""&softdir&""&rs("id")&""&softfile&"""><strong>"&rs("cxn")&"</strong></a></li>"
lb=lb&"<li>内容:"
if rs("body")<>"" then
tempstr=replace(rs("body"),"<br>","")
tempstr=replace(tempstr,"<p>","")
tempstr=replace(tempstr,"</p>","")
tempstr=replace(tempstr,"<b>","")
tempstr=replace(tempstr,"<","")
tempstr=replace(tempstr,">","")
tempstr=replace(tempstr,"/","")
tempstr=replace(tempstr,"&nbsp;","")
lb=lb&""&left(tempstr,300)&" ..."
else
lb=lb&"没有内容"
end if
lb=lb&"</li>"
lb=lb&"<li class=""playBtn""><a class=""play_icon"" href=""../"&softpath&"/"&c(rs("cxn"))&""&softdir&""&rs("id")&""&softfile&"""><span>play</span></a></li></ul></dd></dl>"
if h>=MaxPerPage then exit do
rs.movenext
loop
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
h=0

'#########读取页次
ymfl=ymfl&"Page:"&currentPage&"/"&mpage&" Channel "&allshu&" "
pageno=currentPage
if cint(pageno)>1 then
ymfl=ymfl&"<a href=""../"&softlist&"/"&tid&"_1"&softfile&""">"
end if
ymfl=ymfl&"<font face=""Webdings"">9</font></a>&nbsp;"
if cint(pageno)>1 then
ymfl=ymfl&"<a href=""../"&softlist&"/"&tid&"_"&pageno-1&""&softfile&""">"
end if
ymfl=ymfl&"<font face=""Webdings"">7</font></a>"
pp=cint(pageno)-2      
if pp<1 then
pp=1
end if
for pno=pp to mpage
p=p+1
if pno*1=cint(pageno)*1 then
ymfl=ymfl&"&nbsp;<a href=""#"">["&pno&"]</a>"
else
ymfl=ymfl&"&nbsp;<a href="""&tid&"_"&pno&""&softfile&""">["&pno&"]</a>"
end if                                                               
if p>=6 then exit for         
next
ymfl=ymfl&"&nbsp;"
if cint(pageno)< mpage then
ymfl=ymfl&"<a href=""../"&softlist&"/"&tid&"_"&pageno+1&""&softfile&""">"
end if
ymfl=ymfl&"<font face=""Webdings"">8</font></a>&nbsp;"
if cint(pageno)< mpage then
ymfl=ymfl&"<a href=""../"&softlist&"/"&tid&"_"&mpage&""&softfile&""">"
end if
ymfl=ymfl&"<font face=""Webdings"">:</font></a>"


if request("type")<>"" then
         if request("page")<>"" then
           page=cint(request("page"))
           D=request("D")
         else        
           page=1
           D=timer()
         end if
mpage=1
mpage1=1
MaxPerPage=20
id=request("id")
ts=id&","
set rs=server.createobject("adodb.recordset")
if request("type")="all" then
rs.open ("select id,ts from downtype where ts like '"&request("ts")&"%' order by id desc"),conn,1,1
        if not rs.eof then
        rs.pagesize=1 '得到每页数
        mpage1=rs.pagecount '得到总页数
        rs.move (page-1)*1
        do while not rs.eof
        i=i+1
         id=rs("id")
         ts=rs("ts")
        if i>=1 then exit do
        rs.movenext
        loop
        rs.close
        end if
     end if
'################ 读取完成 ################

pencat=replace(pencat,"T_TYPE",thistype)
pencat=replace(pencat,"T_TITLE",thistitle)
pencat=replace(pencat,"T_NAME",tname)
pencat=replace(pencat,"TXlist",txlist)
pencat=replace(pencat,"TXtop",txtop)
pencat=replace(pencat,"T_LB",lb)
pencat=replace(pencat,"TF_LB",ymfl)

end if

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(server.mappath("../"&softlist&"/"&tid&"_"&currentPage&""&softfile&""))
fout.Write pencat
fout.close
'************** 生成HTML页 结束 ***************
%>
搜索更多相关主题的帖子: style include content html 
2012-09-02 15:12
netlin
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:24
帖 子:544
专家分:4308
注 册:2012-4-9
收藏
得分:20 
代码挺复杂的!

做自己喜欢的事!
2012-09-03 09:19
快速回复:求高手解决下列表分页问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014743 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved