Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Numerazione di pagine per recordset

    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.

    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>
    Il problema è che vorrei una numerazione delle pagine del tipo:

    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!
    Shryne
    --------------------------------------------------
    WebMaster di Loskabrones.net
    --------------------------------------------------

  2. #2
    Azzardo..
    avendo il valore della pagina corrente potresti fare un ciclo do while che , se ci sono, ti mostri i cinque numeri precedenti e il valore corrente, poi ne imposti uno che ti mostri i 5 successivi...

    prova..
    Parafarmacia online, tantissimi prodotti tutti in un click

  3. #3
    Ehm... come? Non sono un professionista di ASP
    Shryne
    --------------------------------------------------
    WebMaster di Loskabrones.net
    --------------------------------------------------

  4. #4
    Nessuno può spiegarmi come modificare il codice?!?!?
    Shryne
    --------------------------------------------------
    WebMaster di Loskabrones.net
    --------------------------------------------------

  5. #5
    Nessuno può spiegarmi come modificare il codice?!?!?
    Shryne
    --------------------------------------------------
    WebMaster di Loskabrones.net
    --------------------------------------------------

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.