Automatic pagination code for ASP long articles

Source: Internet
Author: User
Tags end
 
 
  1. <%
  2. Sub AutoPage ()
  3. Dim Maxpagelen,page,content,pagenumber,articleid
  4. Dim Contentlen
  5. Dim beginpoint,endpoint
  6. maxpagelen=1000
  7. Content=ubbcode (RS ("content"))
  8. Articleid=rs ("ArticleID")
  9. Contentlen=len (content)
  10. Page=request. QueryString ("page")
  11. If Contentlen<=maxpagelen Then
  12. Response. Write Content
  13. Else
  14. If page= "" Then
  15. Page=1
  16. Else
  17. Page=cint (page)
  18. End If
  19. If Pagenumber*maxpagelen
  20. Pagenumberpagenumber=pagenumber+1
  21. End If
  22. Pagenumber=int (Contentlen/maxpagelen) +1
  23. If Page<1 then page=1
  24. If Page>pagenumber then Page=pagenumber
  25. If Page=1 Then
  26. Beginpoint=1
  27. Else
  28. beginpoint=maxpagelen* (page-1) +1
  29. End If
  30. If Page=pagenumber Then
  31. Endpoint=contentlen
  32. Else
  33. Endpoint=maxpagelen*page
  34. If Endpoint>=contentlen Then
  35. Endpoint=contentlen
  36. End If
  37. End If
  38. Content=mid (Content,beginpoint,endpoint-beginpoint)
  39. Response. Write Content
  40. Response. Write "
    "
  41. Response. Write "
    "
  42. Response. Write "
    "
  43. End If
  44. For I=1 to PageNumber
  45. Response. Write " "& I &" "
  46. Next
  47. End Sub
  48. %>
This article links http://www.cxybl.com/html/wlbc/Asp/20120613/29951.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.