<% Function getNext10(num) pageLen = len(num) If pageLen = 1 Then next10 = 4 Else If pageLen>1 Then pageRem = 4 pageTen = right(num, 1) next10 = num + pageRem - pageTen End If End If getNext10 = next10 End Function Function getPrev10(num) pageLen = len(num) If pageLen = 1 then prev10 = 1 Else If pageLen>1 then lastNumber = right(num, 1) prev10 = num - lastNumber - 4 End If End If If prev10 = 0 then prev10 = 1 End If getPrev10 = prev10 End Function If IsEmpty(Request.Querystring("PageNo")) then CurrPage = 1 Else if Request.Querystring("PageNo") <> "" then CurrPage = Cint(Request.Querystring("PageNo")) else CurrPage = 1 end if End If filePath = Server.MapPath("db/News.mdb") ' Crea la connessione ADO Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath ' Creazione del object oRs per la creazione del rs Set Rs= Server.CreateObject("ADODB.Recordset") Set Rs2= Server.CreateObject("ADODB.Recordset") sql = "Select* from news order by IdNews Desc" rs.CursorLocation = 3 rs.open sql,conn rs.PageSize = 10 if not rs.eof then rs.AbsolutePage = CurrPage next10 = getNext10(CurrPage) prev10 = getPrev10(CurrPage) Do Until rs.AbsolutePage <> CurrPage OR rs.Eof %> <%i = i + 1 rs.movenext loop RSPrevPage = CurrPage -1 RSNextPage = CurrPage + 1 If Next10 > rs.PageCount Then Next10 = rs.PageCount End If If prev10 = 1 AND next10 - 1 < 5 Then start = 1 Else start = Next10 - 5 If right(start, 1) > 0 Then start = replace(start, right(start, 1), "0") start = start + 5 End If End If If rs.PageCount > 1 Then 'Work out whether to show the Previous 10 '<<' If next10 > 5 Then paginazione = paginazione & "<<" End If 'Work out whether to show the Previous link '<' If NOT RSPrevPage = 0 then paginazione = paginazione &"< " End If 'Loop through the page number navigation using P as our loopcounter variable For P = start to Next10 If NOT P = CurrPage then paginazione = paginazione &"" & P & " " Else 'Don't hyperlink the current page number 'paginazione = paginazione &" " & P & " " paginazione = paginazione &"" & P & "" End If Next 'this does the same as the "previous" link, but for the "next" link If NOT RSNextPage > rs.PageCount Then paginazione = paginazione &"> " End If 'Work out whether to show the Next 10 '>>' If NOT Next10 = rs.PageCount Then paginazione = paginazione &" >>" End If End if end if %>


<%=rs("TITOLO")%>
<%=left(rs("DESCRIZIONE"),200)%>
<%=paginazione%>