Home  >  Article  >  Backend Development  >  A paging function: display "previous page next page" etc.

A paging function: display "previous page next page" etc.

WBOY
WBOYOriginal
2016-07-25 09:02:511800browse
  1. '************************************ ****************

  2. 'Function name: ShowPage
  3. 'Function: Display "previous page next page" and other information
  4. 'Parameter: sFileName ----Link address
  5. ' TotalNumber ----Total quantity
  6. ' MaxPerPage ----Quantity per page
  7. ' CurrentPage ----Current page
  8. ' ShowTotal ----Whether to display the total quantity
  9. ' ShowAllPages ---Whether to use a drop-down list to display all pages for jumping.
  10. ' strUnit ---- Counting unit
  11. ' ShowMaxPerPage ---- Whether to display the amount of information per page option box
  12. ' Return value: HTML code for information such as "previous page next page"
  13. '****** ************************************************
  14. Function ShowPage(sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage)
  15. Dim TotalPage, strTemp, strUrl, i

  16. If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then

  17. ShowPage = " "
  18. Exit Function
  19. End If
  20. If totalnumber Mod MaxPerPage = 0 Then
  21. TotalPage = totalnumber MaxPerPage
  22. Else
  23. TotalPage = totalnumber MaxPerPage + 1
  24. End If
  25. If CurrentPage > TotalPage Then CurrentPage = TotalPage

  26. If ShowTotal = True Then
  27. strTemp = strTemp & "total" & totalnumber & " " & strUnit & " "
  28. End If
  29. If ShowMaxPerPage = True Then
  30. strUrl = JoinChar(sfilename) & "MaxPerPage=" & MaxPerPage & "&"
  31. Else
  32. strUrl = JoinChar(sfilename)
  33. End If
  34. If CurrentPage = 1 Then
  35. strTemp = strTemp & "Home Previous Page"
  36. Else
  37. strTemp = strTemp & "Home "
  38. strTemp = strTemp & " Previous Page "
  39. End If

  40. If CurrentPage > = TotalPage Then

  41. strTemp = strTemp & "Next page last page"
  42. Else
  43. strTemp = strTemp & "Next Page "
  44. strTemp = strTemp & "Last Page"
  45. End If
  46. strTemp = strTemp & "Page:" & CurrentPage & "/" & TotalPage & "Page"
  47. If ShowMaxPerPage = True Then
  48. strTemp = strTemp & " " & strUnit & "/page"
  49. Else
  50. strTemp = strTemp & " " & MaxPerPage & "" & strUnit & "/Page"
  51. End If
  52. If ShowAllPages = True Then
  53. If TotalPage > 20 Then
  54. strTemp = strTemp & " Go to page Page"
  55. Else
  56. strTemp = strTemp & " Go to: "
  57. End If
  58. End If
  59. strTemp = strTemp & "
"
  • ShowPage = strTemp
  • End Function
  • ?>
  • Copy code


    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Previous article:A small function to detect whether it is a valid email addressNext article:A small function to detect whether it is a valid email address

    Related articles

    See more