Allora... ho un problemino che non so risolvere.
Il seguente codice mostra l'elenco dei post del mio guestbook, 10 per pagina, e la relativa suddivisione delle pagine.
Il problema è che vorrei una numerazione delle pagine del tipo:codice:[img]images/guest.jpg[/img] <% perpage = 10 page = Request.QueryString("pagina") if page = 0 then page = 1 Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open (strCon) Set rsGb = Server.CreateObject("ADODB.Recordset") SQL = "select * from TB_GB order by ID_GB desc" rsGb.Open SQL, Conn, 1, 3 rsGb.PageSize = perpage TotRecords = rsGb.RecordCount If TotRecords = 0 then %> <table width="380" border="0" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="100%"><center>Non ci sono messaggi sul guestbook.</center></td> </tr> </table> <% else rsGb.AbsolutePage = page if TotRecords = 1 then %> <table width="380" border="0" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="100%" height="22"><center>C'e <%=TotRecords%> messaggio nel guestbook.</center></td> </tr> </table> <table width="380" border="0" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="100%"><center>Firma il guestbook</center></td> </tr> </table> <% else %> <table width="380" border="0" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="100%" height="22"><center>Ci sono <%=TotRecords%> messaggi nel guestbook.</center></td> </tr> </table> <table width="380" border="0" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="100%"><center>Firma il guestbook</center></td> </tr> </table> <% end if For i = 1 to perpage if not rsGb.EOF then %> <table width="380" border="0" align="center" cellpadding="2" cellspacing="2"> <tr bgcolor="#FFCC00"> <td width="45%" valign="top" class="giallo_left">Data e ora: <%=rsGb("DATA_GB")%></td> <td width="55%" valign="top" class="giallo">Autore: "><%=rsGb("AUTORE_GB")%></td> </tr> <tr> <td colspan="2" class="rosso"><%=rsGb("MSG_GB")%> </td> </tr> <tr> <td colspan="2" class="testo">[img]/images/pixel.gif[/img]</td> </tr> </table> <% rsGb.MoveNext end if Next end if If TotRecords > 0 then Response.Write "Pagine: " For p = 1 to rsGb.PageCount If p <> CInt(page) then Response.Write "<a href='gb.asp?pagina=" & p & "'>" else Response.Write "" end if Response.Write p If p <> CInt(page) then Response.Write "</a> " else Response.Write " " end if next end if rsGb.Close Set rsGb = Nothing Conn.Close Set Conn = Nothing %> <table width="380" border="0" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="100%"><center>Firma il guestbook</center></td> </tr> </table>
PAGINA : Inizio - Precedente - 1 - 2 - 3 - Successiva - Fine
E invece vengono fuori tutti numeri di pagina e tutte le pagine...
PAGINA : 1 2 3 4 5 6 7 8 9 10 11 ecc..
Fatto così, se i post diventano tanti e le pagine si aggiungono di brutto, avrò una mega lista di numeri di pagine in fondo al mio guestbook.
Qualcuno può dirmi come modificare il mio codice per semplificare la numerazione? Magari rendendola simile a quella di questo forum?
Grazie a tutti!


Rispondi quotando
