% parentid= request("galleryType") if parentid=empty then parentid= findGallery() SQLs = "SELECT GalleryID, Name, image1, image2" & _ " FROM tbGallery" & _ " WHERE Enable=1" & _ " and parentid="&parentid& _ " And IsDelete=0" & _ " ORDER BY Priority, Name" rs.Open SQLs, conn, 0, 1 if rs.EOF then rows_Gallery = -1 else rs_Gallery = rs.GetRows rows_Gallery = UBound(rs_Gallery,2) '------------------------------------- Start Gallery per Page rows_item = rows_Gallery ThisPage = request("page") if ThisPage = empty then ThisPage = 1 if rows_item >= 0 then ThisPage = CInt(ThisPage) rows_item = rows_item + 1 'calculate total page TotalPage = int(FormatNumber((rows_item/PpP)+0.49999,0)) 'check valid page if ThisPage < 1 then ThisPage = 1 elseif ThisPage > TotalPage then ThisPage = TotalPage end if 'set start item in this page sItem = ((ThisPage-1) * PpP) 'set end item in this page if ThisPage = TotalPage then eItem = rows_item - 1 else eItem = sItem + PpP - 1 end if if TotalPage > 1 then strPpP = "Page | " 'คำควณจำนวน page list ที่จะแสดง if TotalPage <= 10 then 'ถ้าน้อยกว่า 11 ให้แสดงแบบปกติ s_countpage = 1 e_countpage = TotalPage else if ThisPage > 5 then if ThisPage+5 > TotalPage then s_countpage = TotalPage-9 e_countpage = TotalPage else s_countpage = ThisPage-4 e_countpage = ThisPage+5 end if else s_countpage = 1 e_countpage = 10 end if end if 'page number for countpage = s_countpage to e_countpage if StrComp(countpage,ThisPage) <> 0 then LinkStr = "" & countpage & "" strPpP = strPpP & LinkStr else strPpP = strPpP & countpage end if strPpP = strPpP & " | " next strPpP = strPpP & " " end if strFound = "" & _ "Found (" & sItem+1 & " - " & eItem+1 & " of " & rows_item & ")" & _ "" end if rs.Close end if %>
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||