% nid = request("nid") rs.open "select nid, name_en, addDate, image1, image2," _ &" image3, image4 from News WHERE enable=true",conn,0,1 if rs.EOF then rows_Item = -1 strFound = 0 else rs_Item = rs.GetRows rows_Item = UBound(rs_Item,2) '------------------------------------- Start Product per Page rows_item = rows_Item ThisPage = request("page") ppp = 20 if ThisPage = empty then ThisPage = 1 if rows_item >= 0 then ThisPage = CInt(ThisPage) rows_item = rows_item + 1 TotalPage = int(FormatNumber((rows_item/PpP)+0.49999,0)) if ThisPage < 1 then ThisPage = 1 elseif ThisPage > TotalPage then ThisPage = TotalPage end if sItem = ((ThisPage-1) * PpP) if ThisPage = TotalPage then eItem = rows_item - 1 else eItem = sItem + PpP - 1 end if if TotalPage > 1 then strPpP = "Page : " max_display = 5 current_position = 3 if TotalPage <= max_display then s_countpage = 1 e_countpage = TotalPage else if ThisPage > current_position then if ThisPage+(max_display-current_position) > TotalPage then s_countpage = TotalPage-(max_display-1) e_countpage = TotalPage else s_countpage = ThisPage-(current_position-1) e_countpage = ThisPage+(max_display-current_position) end if else s_countpage = 1 e_countpage = max_display end if end if 'page number if StrComp(ThisPage,1) <> 0 then LinkStr = "< Back | " strPpP = strPpP & LinkStr else strPpP = strPpP & "< Back | " end if 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 if StrComp(ThisPage,TotalPage) <> 0 then LinkStr = " Next >" strPpP = strPpP & LinkStr else strPpP = strPpP & " Next >" end if strPpP = strPpP & " " end if strFound = "" & _ " found (" & sItem+1 & " - " & eItem+1 & " Total " & rows_item & " item(s)) " & _ "" end if '------------------------------------- End Product per Page end if rs.Close %>