Object-oriented ASP programming seven - Paging object (VBScript version)

zhaozj2021-02-16  354

<*******************************************************************************************************************************************************************************************************************************************************************************TION ******************************** The Script Compont Object Model 'Design for Active Server Pages' 'Copyright 2004 Version 2.0' Made by Yin Shuguang '**************************************************** *************************** function CreateCPageNavbar () set CreateCPageNavbar = new CPageNavbarend functionClass CPageNavbar public SplitSize 'capacity public PnWidth public PnAlign public paginated total number of pages of the current page displayed in the private paging CurrentSplit 'PlWidth' table width public PlAlign 'alignment of the table private PageSize private RecordCount' total records] private PageCount 'pages private CurrentPage' current page private SplitCount 'points Page size '================================================ =============== Private sub class_initialize 'setup initialize Event. Splitsize = 10 pnWidth = "100%" PNALIGN = "Right" PLWIDTH = "100%" // Table Width PLALIGN = " Right "// Table alignment Pagesize = 0 Recordcount = 0 CURRENTPAGE = 1 PageCount = 1 SplitCount = 1 CurrentSplit = 1 End Sub Private Sub Class_Terminate 'Setup Terminate event. End Sub public sub InitPageNavbar (byval iPageSize, byval iRecordCount) PageSize = cint (iPageSize) RecordCount = clng (iRecordCount) PageCount = fix (RecordCount / PageSize

1 splitcount = fix (pagecount / splitsize) 1 End subpublic function getCurrentPage () 'on error resume Next Dim Pageno Pageno = Trim ("_page_no_"))' If you do not choose the first few pages, the first is the first Page; if isnumeric (PAGENO)) or Pageno = "") THEN PAGENO = 1 end if currentpage = clng (PAGENO) IF (CurrentPage <1) THEN CURRENTPAGE = 1 End ififf (currentpage> PageCount) THEN CURRENTPAGE = PageCount end if currentsplit = fix (currentpage / splitsize) 1 getCurrentPage = CURRENTPAGE END FUNCTION

public function plDisplay () dim strBuilder, p, itmp strBuilder = "" 'first group of group 0 strBuilder = strBuilder "

"strBuilder = strBuilder " "strBuilder = strBuilder "
page: "if (CurrentSplit = 1) then strBuilder = strbuilder 9 "strbuilder = strbuilder " 7 "else strbuilder = Strbuilder 9 "strbuilder = strbuilder 7 " end if strabuilder = strbuilder " "Page List ITMP = (Currentsplit-1) * Splitsize 1 for i = ITMP To (ITMP Splitsize-1) IF (i = currentpage) Ten strbuilder = strbuilder >> "& CS Tr (I) & "" else strbuilder = strbuilder

Title = 'Go to: "& CSTR (I) &" Page'> & CSTR (i) & " = pagecount) THEN EXIT for end if Next strbuilder = strbuilder "'Show 10 IF (currentsplit 8 "strbuilder = strbuilder " : < / font> "else strbuilder = strbuilder " 8 "strbuilder = strbuilder " : "end if strBuilder = strBuilder " "Response.Write (strBuilder) end function public function pnDisplay () dim strBuilder, nextPageNo strBuilder =" "strBuilder = strBuilder "

" strBuilder = strBuilder "" strBuilder = strBuilder
Page: [ & CSTR (CURRENTPAGE) & " / " & cstr (pagecount) & "

] Page Each page [ "&" PageSize) & "PageSize) 条 total record number: [" & cstr (recordcount) & "]: " strbuilder = strbuilder "

" IF (CINT (CURRENTPAGE)> 1) Then nextpageno = CINT (CURRENTPAGE) -1 strbuilder = strbuilder "[ Previous ] "End (CintPage)