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

    Impaginare risultati su 3 colonne

    come posso fare a stampare 3 prodotti per colonna quindi divisi su 3 righe? Adesso me li stampa in fila orizzontale io vorrei fare una cosa come questa


    codice:
    <% 
    '---Dichiarazione variabili
    	Dim ObjConn, StrSQL
    	'APERTURA CONNESSIONE CON IL DATABASE SENZA DSN 
    	Set objConn = Server.CreateObject("ADODB.Connection") 
    	objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/_private/Tekshop.mdb")
    	strSQL="SELECT TOP 9 * FROM Prodotti where New= true AND Cancellato = False ORDER BY Data DESC"
    	set rs=server.CreateObject("ADODB.recordset")
    	rs.Open strSQL, objConn
    	do while not rs.EOF
    %>
        </td>
        <td width="77%" valign="top"><table width="130"  border="0" cellpadding="2" cellspacing="0">
          <tr>
            <td><div align="center"><span class="right">"><%=rs("Prodotto")%></span></div></td>
          </tr>
          <tr>
            <td><div align="center">">[img]<%=rs([/img]" border="0"></div></td>
          </tr>
          <tr>
            <td class="testo"><div align="center"><span class="right"></span> <%=rs("Descrizione")%></div></td>
          </tr>
        </table></td>
        <td width="12%"><%
    rs.movenext 
    loop
    %>
        </td>
      </tr>
    </table>

  2. #2
    devi farti un contatore, una cosa del tipo

    contatore = 0
    Do While not rs.eof
    contatore = contatore + 1
    ... inserisci l'immagine
    if contatore = 3 then
    Response.Write("
    ")
    contatore = 0
    end if
    rs.movenext
    Loop

    prova ad adattare il meccanismo alle tue necessità...
    Chi Non RisiKa noN RosiKa

  3. #3
    Grazie! Sì ho fato così ma mi scirve il nome del file della foto ma non stampa la foto

    codice:
    <%contatore = 0
    Do While not rs.eof
    contatore = contatore + 1
    Response.Write RS("PFoto")
    if contatore = 3 then
    Response.Write("
    ")
    contatore = 0
    end if
    rs.movenext
    Loop %>

  4. #4
    per far stampare la foto devi fare così:

    <%contatore = 0
    Do While not rs.eof
    contatore = contatore + 1
    %>
    [img]images/<%=RS([/img]">
    <%
    if contatore = 3 then
    Response.Write("
    ")
    contatore = 0
    end if
    rs.movenext
    Loop %>
    Chi Non RisiKa noN RosiKa

  5. #5
    cavolo non riesco....volevo mettere sotto alla foto il testo del campo "descrizione" ma non me lo fa vedere...

    codice:
    <% contatore = 0
    Do While not rs.eof
    contatore = contatore + 1
    %>
    <a href="scheda.asp?id=<%=RS("ID")%>"><img src="
    <%
    If RS("PFoto") <> "" Then
    Response.Write RS("PFoto")
    Else
    Response.Write ""
    End If
    %>" alt="<%=RS("Descrizione")%>" title="<%=RS("Descrizione")%>" width="<%=PFoto_Larghezza%>" height="<%=PFoto_Altezza%>" border="0"></a>
    <span class="testo">
    <% 
    nc = 100 'Numero di caratteri
    testo = RS("Descrizione") 
    While mid(testo,nc,1) <> " "
    	nc = nc - 1
    Wend
    testo = Left(testo,nc) & "...dettagli"
    testo = Replace(testo,VbCrLF,"
    ")
    Response.write(replace(testo,". ",". 
    "))
    %>
    </span>
    <%
    if contatore = 3 then
    Response.Write("
    ")
    contatore = 0
    end if
    rs.movenext
    Loop %>

  6. #6
    un aiutino...vi prego! volevo stampare foto e sotto il testo su 3 colonne come qui


  7. #7
    Io uso questo sistema:

    codice:
    <%
    Cella = 1 
    
    	Do until objrs.eof 
    	
    		If Cella = 1 Then 
    			Response.Write "<tr>" 
    		end if 
    	
    		Response.Write "<td width='120'> <div align='right' class='linkpiccoli'><font color='#454545'>" & objrs("Campo") & "</font>"
    	  	Response.Write "</div></td>" 
    	
    		Cella = Cella + 1 
    		
    		If Cella = 4 Then 
    		   Response.Write "</tr>" 
    		   cella = 1 
    		end if 
    		
    		objrs.movenext
    	Loop
    %>
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

  8. #8
    ti ringrazio ma così mi stampa il nome del file della foto e non la foto...

    codice:
    <% 
    '---Dichiarazione variabili
    	Dim ObjConn, StrSQL, cella
    	'APERTURA CONNESSIONE CON IL DATABASE SENZA DSN 
    	Set objConn = Server.CreateObject("ADODB.Connection") 
    	objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/_private/Tekshop.mdb")
    	strSQL="SELECT TOP 9 * FROM Prodotti where New= true AND Cancellato = False ORDER BY Data DESC"
    	set rs=server.CreateObject("ADODB.recordset")
    	rs.Open strSQL, objConn
    	%>
    
    <table width="100%" height="9%" border="0" cellpadding="1" cellspacing="0">
      <tr>
        <td width="100%" height="100%">
          <div align="center">
    <%
    Cella = 1 
    
    	Do until rs.eof 
    	
    		If Cella = 1 Then 
    			Response.Write "<tr>" 
    		end if 
    	
    		Response.Write "<td width='120'> <div align='right' class='linkpiccoli'><font color='#454545'>" & rs("PFoto") & "</font> "
    	  	Response.Write "</div></td>" 
    	
    		Cella = Cella + 1 
    		
    		If Cella = 4 Then 
    		   Response.Write "</tr>" 
    		   cella = 1 
    		end if 
    		
    		rs.movenext
    	Loop
    %>

  9. #9
    ora sono riuscito ma volevo anche aggioungere sotto alla foto un altro campo "descrizione" del DB

    codice:
    <%
    Cella = 1 
    
    	Do until rs.eof 
    	
    		If Cella = 1 Then 
    			Response.Write "<tr>" 
    		end if %>
    <a href="scheda.asp?id=<%=rs("Id")%>"><img src="
    <%
    If rs("PFoto") <> "" Then 
    Response.Write rs("PFoto")
    else
    Response.Write ""
    End If
    %>" width="<%=PFoto_Larghezza%>" height="<%=PFoto_Altezza%>" border="0"></a>
    <% Response.Write "</div></td>" 
    	
    		Cella = Cella + 1 
    		
    		If Cella = 4 Then 
    		   Response.Write "</tr>" 
    		   cella = 1 
    		end if 
    		
    		rs.movenext
    	Loop
    %>

  10. #10
    Leggilo e stampalo.
    Ormai l'algoritmo è costruito.
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

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 © 2026 vBulletin Solutions, Inc. All rights reserved.