标题:请教各位大侠生成静态分页的问题
只看楼主
a309223515
Rank: 2
等 级:论坛游民
帖 子:29
专家分:10
注 册:2010-4-8
结帖率:77.78%
已结贴  问题点数:20 回复次数:2 
请教各位大侠生成静态分页的问题
刚做的一个生成静态分页的,生是生成功了但是生成的每页的内容都是相同的(上一页的内容和下一页的内容相同)而且这个分页(动态)好像还不好使
麻烦各位大侠帮年一下
   
    这是后台的生成页面
  Private Sub Createpage()
  server.ScriptTimeout=300
  Set Rs=Server.CreateObject("Adodb.recordset")
  Sql="select * From [PubPress]"
  Rs.open Sql,conn,1,1
  Rs.PageSize=10
  If Rs.eof then
    response.Write("无文章需要生成")
  Else  
  page=1
  Do While Not Rs.eof and page<=Rs.PageCount
  for i=1 to Rs.PageCount
  response.Write "../Catalog_"&page&".html"
 
  path=server.MapPath("../"&Catalog&"_"&page&".html")
  'response.Write path
  'response.end
  port=request.ServerVariables("SERVER_Port")
  StrURL="http://"&request.ServerVariables("SERVER_NAME")&":"&port&"/文学教育/HTML/Catalog.asp"   
  StrURL="http://"&request.ServerVariables("SERVER_NAME")&":"&port&"/HTML/Catalog.asp?id="&rs("id")&""  
  Response.write(StrURL&"<br>")
  Set ObjXmlHttp=Server.CreateObject("Microsoft.XMLHTTP")
     ObjXmlHttp.open "GET",StrURL,false
     ObjXmlHttp.send()
     binFileData=ObjXmlHttp.responseBody
  Set ObjAdoStream=Server.CreateObject("Adodb.Stream")
      ObjAdoStream.Type=1
      ObjAdoStream.open()
      ObjAdoStream.write(binFileData)
      ObjAdoStream.SaveToFile path,2
    Rs.movenext
    page=page+1
    Next
    Loop
      ObjAdoStream.Close()
   Response.Write("列表页面生成完毕!<br>")
   End if
 End Sub

      Private Sub CreateLine()
      Response.write("<hr style='width='80%;color:red;''/>")
      End Sub
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

这是前台的动态页面,我把ASP换成了HTML
                          <%
                            SmallClass=Request.QueryString("SmallClass")
                            If SmallClass="" then
                            SmallClass="Catalog"
                            'end if   
                            Page = Request.QueryString("page")
                            If IsNull(Page) Then
                            Page = 1
                            Elseif IsNumeric(Page) = False Then
                            Page = 1
                            Elseif Page < 1 OR Page > 200 Then
                            Page = 1
                            Else
                            Page = Cint(Page)
                            End if
                            Set Rs=Server.CreateObject("Adodb.Recordset")
                            Sql="select * from [PubPress] order by id desc"
                            Rs.open Sql,conn,1,1                       
                            If Rs.RecordCount > 0 Then
                            Rs.PageSize =1
                            If Page > Rs.PageCount Then Rs.AbsolutePage = Rs.PageCount Else Rs.AbsolutePage = Page
                            Rs.AbsolutePage = Page
                            For j=1 to Rs.PageSize
                            If Rs.eof then Exit for
        
                               call ShowCatalog(5,20,1,1,1)
                        
                            Next
                            End if
                           %>
                    </ul>
                     <div align="center">共<%=Rs.RecordCount%>条新闻,第<%=page%>/<%=Rs.PageCount%>页
                        <%if page=1 then%>
                        首页
                        <%else%>
                        <a href="Catalog_1.html">首页</a>
                        <%end if%>
                        
                        <%if page=1 then%>
                        上一页
                        <%else%>
                        <a href="Catalog_<%=page-1%>.html">上一页</a>
                        <%end if%>
                        
                        <%if rs.pagecount<page+1 then%>
                        下一页
                        <%else%>
                        <a href="Catalog_<%=page+1%>.html">下一页</a>
                        <%end if%>
                        <%if rs.pagecount<page+1 then%>
                        尾页
                        <%else%>
                        <a href="Catalog_<%=rs.pagecount%>.html">尾页</a>
                        <%end if%>
                        <%end if%>



 
搜索更多相关主题的帖子: 文章 
2011-04-06 00:37
hams
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:18
帖 子:912
专家分:3670
注 册:2008-7-30
得分:14 
  StrURL="http://"&request.ServerVariables("SERVER_NAME")&":"&port&"/文学教育/HTML/Catalog.asp"   
  StrURL="http://"&request.ServerVariables("SERVER_NAME")&":"&port&"/HTML/Catalog.asp?id="&rs("id")&""
这样的赋值有意义么?

俺不高手,俺也是来学习的。
俺的意见不一定就对,当你不认同时请点忽视按钮。
当走到十字路口不知该如何走时,可在论坛问下路,但你若希望别人能一路把你送到目的地,显然是不现实的,因为别人也有自己要走的路。
2011-04-06 08:43
a309223515
Rank: 2
等 级:论坛游民
帖 子:29
专家分:10
注 册:2010-4-8
得分:0 
回复 2楼 hams
这个是我在本地测试才加上去的,上传的话是要去掉的
2011-04-06 08:45



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-335734-1-1.html




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

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