hi,

i have an online store builded in classic ASP. i have this script for paging the products (10 items per page).

Code:
if ppp = "" then ppp=10

cSQL = "SELECT COUNT(*) AS rows FROM products WHERE cat='"&cat&"' AND active=1"

set cRS=con.execute(cSQL)
myrows = Cint(cRS("rows"))

sql = "SELECT * FROM products WHERE cat='"&cat&"' AND active=1 ORDER BY "&ord&" LIMIT "&(pg-1)*ppp&", "&ppp

set prodRS=con.execute(sql)

nmpages=myrows/ppp
nmpg = Round(nmpages)
if nmpg < nmpages then
nmpg = nmpg + 1
end if


'pagination
for i = 1 to nmpg
if i <> cINT(pg) then
response.Write(" <a href=""?cat="&cat&"&pg="&i&""">"&i&"</a>")
end if
next
In some categories i have a lot of products and i have a huge number of pages (eg: 128 pages for 1280 products in one category).

I want to display the pages like some forums
eg: 1 2 3 4 5 82 105 128 (when page = 1)
or 1 32 48 49 50 51 52 94 110 128 (when the selectet page = 50)
or: 1 64 98 99 100 101 102 120 128 (when the selectet page = 100)
etc...

i have the script for next, previous, first, last pages. i want only some script for the example above.

thanks in advance.