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

    Paginazione su 2 colonne

    ciao ho guardato nel forum e ho visto qualcosa ma non riesco a inglobarlo in questo script
    che vi mostro sotto visualizza la paginazione classica:

    record 1
    record 2
    record 3

    io vorrei fare questo tipo di paginazione

    record 1 record 2
    record 3 record 4

    per un massimo di 6 o 8 record per pagina e poi in automatico dare la possbilità di passare alla pg sucessiva ecco il codice... chi mi aiuta?

    Codice PHP:
    <%
                
    dim objConniPageSizeiPageCurrentstrSQLobjRSreccountiPageCountiRecordsShowncontda_pagfino_a_pagi
                iPageSize 
    'NUMERO RECORD PER PAGINA

                If Request.QueryString("page") = "" Then
                    iPageCurrent = 1
                Else
                    iPageCurrent = CInt(Request.QueryString("page"))
                End If

                strSQL = "SELECT * FROM promo where visualizza=true ORDER BY id desc"
                Set objRS = Server.CreateObject("ADODB.Recordset")
                objRS.PageSize = iPageSize
                objRS.CacheSize = iPageSize
                objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText

                reccount = objRS.recordcount
                iPageCount = objRS.PageCount

                If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
                If iPageCurrent < 1 Then iPageCurrent = 1

                If iPageCount = 0 Then
                    Response.Write "

    <table><td align='
    center'><font face='verdana' size='2' color='#000000'>[b]<div align='center'>Non sono stati trovate Promozioni & offerte</div>[/b]</td></table></p>"
                
    Else
                    
    objRS.AbsolutePage iPageCurrent
                    iRecordsShown 
    0
                    
    %>

                    
                    <
    table width="100%" height="100%" border="1" cellspacing="0" cellpadding="0">
                    <
    tr>
                    
                    <%
                                    
    'SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL
                                    '
    ALL'INTERNO DELLA TABELLA PRIMA DEFINITA
                                    cont=1
                                    
                                    Do While iRecordsShown < iPageSize And Not objRS.EOF
                                        Dim Rig, bg
                                        Rig = Rig + 1
                                        If Rig Mod 2 = 0 then
                                            bg = "sfolongform"
                                        Else
                                            bg = "sfo_form_padova"    
                                        End if    
                                        
                                        Dim Rig1, bg1
                                        Rig1 = Rig1 + 1
                                        If Rig1 Mod 2 = 0 then
                                            bg1 = "sedelongareblu"
                                        Else
                                            bg1 = "sfo_arancio_padova"    
                                        End if    
                                        %>
                                        
                                        
                                        <tr>
        <td colspan="2"  <%Response.Write "class = " & bg & ""%>><div align="left" class="standard">[b]<%= (iPageSize*iPageCurrent)-iPageSize+Cont %>[/b].[b]<% response.write(ucase(objRS("titolo"))) %> [/b]</div></td>
      </tr>
      <tr>
        <td colspan="2" height="4"></td>
      </tr>
      <tr>
      <td width="9%">
                        <% ' 
    verifica che se c'è una img mette l'img altrimenti mette no_img.gif
                         
    if objRS("img") <>"" Then %>
                        [
    img]../img/software/<%=(objRS([/img]" height="60" width="90" border="1" hspace="1" vspace="1">
                        <% else %>
                        [img]../img/no_img.gif[/img]
                        <% end if %>
        </td>
        <td width="
    91%" valign="top"><div align="justify" class="standard">[img]<%response.write percorso%>img/freccia.gif[/img]
                    <%=(objRS("
    descrizione"))%>
                    

                    
                    <% if objRS("
    pagina") <>"" Then %>
                        [[url="
    <%=(objRS("]" class="collegtop" title="Leggi la recensione completa">Leggi la recensione completa[/url]]</div></td>
                    <% else %>
                        [[
    url="pagina_software.asp?software=<%=(objRS("]" class="collegtop" title="Leggi la recensione completa">Leggi la recensione completa[/url]]</div></td>
                    <% end if %>
                        </tr>    
                         <tr>
        <td colspan="
    2" height="5"></td>
                        </tr>
                        <td colspan="
    2" height="1" <%Response.Write "class = " & bg1 & ""%>></td>
                        </tr>
                        <td colspan="
    2" height="15"></td>
                        </tr>                
                                        
                                        
                                        <%
                                        Cont = Cont + 1
                                        'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB
                                        iRecordsShown = iRecordsShown + 1
                                        objRS.MoveNext
                                    Loop
                                    'PULIZIA DEGLI OGGETTI ADO
                                    objRS.Close
                                    Set objRS = Nothing
                                    %>
                                    
                              
    </table>
                <%End if%>
                


                <%If ipagecount <> 1 Then%>
                    <center>
                    <table border="
    0" height="100%">
                        <tr valign="
    middle">
                            <td width="
    50%" align="center" valign="middle">
                                [b]<span class="
    standard">[
                                <%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%>
                                    [url="
    promo_computer.asp?page=1"][img]<%response.write percorso%>img/first.gif[/img][/url]
                                <%end if%>
                                <%if iPageCurrent > 1 then%>
                                    [url="
    promo_computer.asp?page=<%=iPageCurrent-1%>"][img]<%response.write percorso%>img/pre.gif[/img][/url]
                                <%end if%>
                                <%if iPageCount > 2 then
                                    if iPageCurrent-2 < 1 then da_pag = 1 else da_pag = iPageCurrent-2
                                    if iPageCurrent+2 > iPageCount then fino_a_pag = iPageCount else fino_a_pag = iPageCurrent+2
                                else
                                    da_pag = 1
                                    fino_a_pag = iPageCount
                                end if%>
                                <%for i = da_pag to fino_a_pag%>
                                    <%if i = iPageCurrent then%>
                                        <font class="
    linkinterno"><%=i%></font>
                                    <%else%>    
                                        [url="
    promo_computer.asp?page=<%=i%>"]<%=i%>[/url]
                                    <%end if%>    
                                <%next%>
                                <%if iPageCurrent > 0 and iPageCurrent < iPageCount then%>
                                    [url="
    promo_computer.asp?page=<%=iPageCurrent+1%>"][img]<%response.write percorso%>img/next.gif[/img][/url]
                                <%end if%>    
                                <%if iPageCurrent+1 < iPageCount then%>
                                    [url="
    promo_computer.asp?page=<%=iPageCount%>"][img]<%response.write percorso%>img/last.gif[/img][/url]
                                <%end if%>    
                                ]</span>[/b]
                            </td>
                        </tr>
                        <tr>
                            <td colspan="
    2" align="center"><font face="verdana" size="1" color="#000000">
                                
    <center>
                                
    Pagina
                                    
    <font color="#FF0000">[b]<%=iPageCurrent%>[/b]</font>
                                    
    di
                                    
    <font color="#FF0000">[b]<%=iPageCount%>[/b]</font>
                                </
    center>
                            </
    font></td>
                        </
    tr>
                    </
    table>
                    </
    center>
                <%
    end if%>
                <%
                
    objConn.Close
                Set objConn 
    Nothing
                
    %> 
    questo è il codice per visualizzare il tutto in colonne:

    Codice PHP:
    <%'creo il recordset
    dim NumeroColonne, id
    if not objRS.EOF then
        NumeroColonne = 2
    %>
    <table width="100%" border="1" cellspacing="0" cellpadding="0">
    <% cont=0
    while not objRS.EOF
        cont=cont+1
        if ((cont-1) mod NumeroColonne)=0 then%>
    <tr><%
        end if%>
    <td>
        <table  cellpadding="0" border="1" cellspacing="0">
        <tr>
            <td rowspan="3"></td>
            <td>[b]prova[/b]</td>
        <tr>
            <td>
                [b]<%= objRS("DESCRIZIONE")%>[/b]

                € <%= objRS("prezzo")%>
                

                </td>
        </tr>
        <tr>    
            <td colspan="2">[url="prodotto.asp"]Dettagli[/url]</td>
        </tr>
        </table>
    </td><%
        if (cont mod NumeroColonne)=0 then%>
    </tr><%
        end if
        id = id+1
        objRS.movenext 
    wend
    for i=((cont mod NumeroColonne)+1) to NumeroColonne%>
    <td>ciao</td><%    
    next%>
    </table><%
    end if%> 
    solo che non riesco ad implementralo con il primo codice che vi ho mostrato..

  2. #2

  3. #3

  4. #4
    Utente di HTML.it L'avatar di Fichico
    Registrato dal
    Nov 2002
    residenza
    Bologna
    Messaggi
    581
    codice:
    inizio_ciclo = 0
    fine_ciclo = 36
    
    response.Write("<table border=""1"">" & VbCrLf)
    response.Write("<tr>" & VbCrLf)
    counter = 0
    for x = inizio_ciclo to fine_ciclo
    	if counter = 1 then 'destra
    		response.write("</td>" & VbCrLf)
    	elseif counter = 2 then 'sinistra
    		counter = 0 
    		response.write("</td>" & VbCrLf)
    		response.Write("</tr>" & VbCrLf)
    		response.Write("<tr>" & VbCrLf)
    	end if
    	response.Write("<td>")
    	
    	response.write("" & x & "")
    	counter = counter+1
    next
    
    response.write("</td>" & VbCrLf)
    if counter mod 2 <> 0 then
    	response.Write("<td></td>" & VbCrLf)
    end if
    response.write("</tr>" & VbCrLf)
    response.write("</table>" & VbCrLf)
    cambiando inizio e fine ciclo vedrai che se le "stampe" sono dispari completa da solo l'ultima cella con uno spazio al suo interno

    non so come sia nello specifico il tuo codice perchè non ho tempo per guardarci ma da queste poche righe di codice sicuramente avrai una base su come muoverti

  5. #5
    grazie per la risp... ma dove lo devo mettere il codice?

    ho ripeso il codice sopra l'ho modificato ma ovviamente non è ancora sistemato... lo puoi guardare un attimo
    Codice PHP:
    <%
    dim objConnpercorso
    Set objConn 
    Server.CreateObject("ADODB.Connection")
    objConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("db/penta.mdb")

                
    dim iPageSizeiPageCurrentstrSQLobjRSreccountiPageCountiRecordsShowncontda_pagfino_a_pagi,NumeroColonne,id1
                iPageSize 
    'NUMERO RECORD PER PAGINA

                If Request.QueryString("page") = "" Then
                    iPageCurrent = 1
                Else
                    iPageCurrent = CInt(Request.QueryString("page"))
                End If

                strSQL = "SELECT * FROM promo"
                Set objRS = Server.CreateObject("ADODB.Recordset")
                objRS.PageSize = iPageSize
                objRS.CacheSize = iPageSize
                objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText

                reccount = objRS.recordcount
                iPageCount = objRS.PageCount

                If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
                If iPageCurrent < 1 Then iPageCurrent = 1

                If iPageCount = 0 Then
                    Response.Write "Non sono stati trovati Software"
                Else
                    objRS.AbsolutePage = iPageCurrent
                    iRecordsShown = 0
                    %>
                    <table width="100%" height="100%" border="1" cellspacing="0" cellpadding="0">
                    <tr>                                
                                    <%
                                    '
    SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL ALL'INTERNO DELLA TABELLA PRIMA DEFINITA
                                    cont=1
                                    %>
                                        
                                        <table cellspacing="0" border="1" cellpadding="0">
                                        <%'
    creo il recordset
                                        
    if not objRS.EOF then
                                        NumeroColonne 
    2
                                        cont
    =0
                                        
    while not objRS.EOF
                                        cont
    =cont+1
                                        
    if ((cont-1mod NumeroColonne)=0 then%>
                                        <
    tr>
                                        <%
    end if%>
                                        <
    td>
                                            <
    table width="230" cellpadding="0" border="1" cellspacing="0">
                                                <
    tr>
                                                    <
    td rowspan="2">[img]prodotti/.jpg[/img]</td>
                                                    <
    td>[b]<%= objRS("titolo")%>[/b]</td>
                                                <
    tr>
                                                    <
    td>[b]<%= objRS("DESCRIZIONE")%>[/b]


                                                    </
    td>
                                                </
    tr>
                                                <
    tr>    
                                                    <
    td colspan="2">[url="prodotto.asp?pid="]Dettagli[/url]</td>
                                                </
    tr>
                                            </
    table>
                                        </
    td><%
                                            if (
    cont mod NumeroColonne)=0 then%>
                                    </
    tr><%
                                    
    end if
                                    
    id1 id1+1
                                    objRS
    .movenext 
                                    wend
                                    
    for i=((cont mod NumeroColonne)+1to NumeroColonne%>
                                    <
    td>ciao</td><%    
                                    
    next%>
                                    </
    table>    
                                    <%
    end if%>                    
                                                
                                        
                                        <%
                                        
                                    
    'PULIZIA DEGLI OGGETTI ADO
                                    objRS.Close
                                    Set objRS = Nothing
                                    %>
                                    
                              
    </table>
                <%End if%>
                


                <%If ipagecount <> 1 Then%>
                    <center>
                    <% '
    mostra la paginazione cioè le pagine avanti e indietro e visualizza il numero di pagine%>

                    <
    table border="1" height="100%">
                        <
    tr valign="middle">
                            <
    td width="50%" align="center" valign="middle">
                                [
    b]<span class="standard">[
                                <%if 
    iPageCurrent-and iPageCurrent 2 then%>
                                    [
    url="paginazione2.asp?page=1"]img[/url]
                                <%
    end if%>
                                <%if 
    iPageCurrent 1 then%>
                                    [
    url="paginazione2.asp?page=<%=iPageCurrent-1%>"]prec[/url]
                                <%
    end if%>
                                <%if 
    iPageCount 2 then
                                    
    if iPageCurrent-1 then da_pag else da_pag iPageCurrent-2
                                    
    if iPageCurrent+iPageCount then fino_a_pag iPageCount else fino_a_pag iPageCurrent+2
                                
    else
                                    
    da_pag 1
                                    fino_a_pag 
    iPageCount
                                end 
    if%>
                                <%for 
    da_pag to fino_a_pag%>
                                    <%if 
    iPageCurrent then%>
                                        <
    font class="linkinterno"><%=i%></font>
                                    <%else%>    
                                        [
    url="paginazione2.asp?page=<%=i%>"]<%=i%>[/url]
                                    <%
    end if%>    
                                <%
    next%>
                                <%if 
    iPageCurrent and iPageCurrent iPageCount then%>
                                    [
    url="paginazione2.asp?page=<%=iPageCurrent+1%>"]succ[/url]
                                <%
    end if%>    
                                <%if 
    iPageCurrent+iPageCount then%>
                                    [
    url="paginazione2.asp?page=<%=iPageCount%>"]pag[/url]
                                <%
    end if%>    
                                ]</
    span>[/b]
                            </
    td>
                        </
    tr>
                        <
    tr>
                            <
    td colspan="2" align="center"><font face="verdana" size="1" color="#000000">
                                <
    center>
                                
    Pagina
                                    
    <font color="#FF0000">[b]<%=iPageCurrent%>[/b]</font>
                                    
    di
                                    
    <font color="#FF0000">[b]<%=iPageCount%>[/b]</font>
                                </
    center>
                            </
    font></td>
                        </
    tr>
                    </
    table>
                    </
    center>
                <%
    ' fine tabella che mostra la paginazione %>
                
                
                
                
                <%end if%>
                
    <%
    objConn.Close
    Set objConn = Nothing
    %></tr> 
    </table> 

  6. #6
    un piccolo help ... oppure un link ...

  7. #7
    ho semplificato un po' il codice... ci sono quasi un piccolo aiutino...
    Codice PHP:
    <%
    dim objConnpercorso
    Set objConn 
    Server.CreateObject("ADODB.Connection")
    objConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("db/penta.mdb")

                
    dim iPageSizeiPageCurrentstrSQLobjRSreccountiPageCountiRecordsShowncontda_pagfino_a_pagi,NumeroColonne,id1
                iPageSize 
    'NUMERO RECORD PER PAGINA

                If Request.QueryString("page") = "" Then
                    iPageCurrent = 1
                Else
                    iPageCurrent = CInt(Request.QueryString("page"))
                End If

                strSQL = "SELECT * FROM promo"
                Set objRS = Server.CreateObject("ADODB.Recordset")
                objRS.PageSize = iPageSize
                objRS.CacheSize = iPageSize
                objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText

                reccount = objRS.recordcount
                iPageCount = objRS.PageCount

                If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
                If iPageCurrent < 1 Then iPageCurrent = 1

                If iPageCount = 0 Then
                    Response.Write "Non sono stati trovati Software"
                Else
                    objRS.AbsolutePage = iPageCurrent
                    iRecordsShown = 0
                    %>
                    <table width="100%" height="100%" border="1" cellspacing="0" cellpadding="0">
                    <tr>                                
                                    <%
                                    '
    SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL ALL'INTERNO DELLA TABELLA PRIMA DEFINITA
                                    cont=1
                                    %>

                                        <table border="1">
                                        <%
                                        dim conta
                                        conta=1
                                        while not objRS.eof
                                        if conta=1 then
                                        %>
                                        <tr>
                                        <%
                                        end if
                                        %>
                                        <td><%= objRS("titolo") %></td>
                                        <%
                                        if conta=2 then
                                        %>
                                        </tr>
                                        <%
                                        conta=0
                                        end if

                                        conta=conta+1
                                        objRS.movenext
                                        wend
                                        %>
                                        </table>
            
                        
                                        
                                        <%
                                        
                                    '
    PULIZIA DEGLI OGGETTI ADO
                                    objRS
    .Close
                                    Set objRS 
    Nothing
                                    
    %>
                                    
                                    
                              
    </
    table>
                <%
    End if%> 

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.