Salve ragazzi.
Io ho lo script di seguito, che serve praticamente come "paginazione" (l'ho prelevato dal sito di un utente del forum).
In questa paginazione viene richiamato anche un valore numerico, sottoforma di normali numeri 1,2,3,4 o 5.
Vorrei che questi numeri venissero "convertiti" in numero di immagini da visualizzare.. O meglio.. laddove il numero è 4, vorrei visualizzare per 4 volte l'immagine "prova.gif".
Esiste un metodo per fare ciò? (Ovviamente si).
Questo è lo script, in grassetto è il valore numerico da "trasformare".
codice:<% iPageSize = 10 'NUMERO RECORD PER PAGINA If Request.QueryString("page") = "" Then iPageCurrent = 1 Else iPageCurrent = CInt(Request.QueryString("page")) End If strSQL = "SELECT * FROM Roma ORDER BY minrate ASC" Set objRS = Server.CreateObject("ADODB.Recordset") objRS.PageSize = iPageSize objRS.CacheSize = iPageSize objRS.Open strSQL, connessione, 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 "No hotels found." Else objRS.AbsolutePage = iPageCurrent iRecordsShown = 0 %> <% '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 = "#E4E4E4" Else bg = "#ccccff" End if Response.Write "<table class='tabhotel' width='400' border='0' cellpadding='0' cellspacing='0'><tr>" Response.Write "<td width='345' height='15' bgcolor='#EEEEEE'><a <a class='corpocentrale'>" & objRS("Name") & "</a></td>" Response.Write "<td width='55'>" & objRS("class") & "</td></tr>" Response.Write "<tr><td height='15' colspan='2' valign='top' align='right'>from " & objRS("minrate") & " €</td></tr>" Response.Write "<tr><td colspan='2' valign='top'>[img]" & objRS("photo_url") & "[/img]" & objRS("desc_en") & " " Response.Write "<div align='right'>Reserve now!</div></td>" Response.Write "</tr></table> " Cont = Cont + 1 'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB iRecordsShown = iRecordsShown + 1 objRS.MoveNext Loop 'PULIZIA DEGLI OGGETTI ADO objRS.Close Set objRS = Nothing %> <%End if%> <%If ipagecount <> 1 Then%><center> <div align="center"> [ <%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%> [img]imgs/first.gif[/img] <%end if%> <%if iPageCurrent > 1 then%> [img]imgs/pre.gif[/img] <%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%> <%=i%> <%else%> <%=i%> <%end if%> <%next%> <%if iPageCurrent > 0 and iPageCurrent < iPageCount then%> [img]imgs/next.gif[/img] <%end if%> <%if iPageCurrent+1 < iPageCount then%> [img]imgs/last.gif[/img] <%end if%> ] </div> <div align="center"> Pagina <a class="corpocentrale"><%=iPageCurrent%></a> di <a class="corpocentrale"><%=iPageCount%></a> </div> <%end if%> <% connessione.Close Set connessione = Nothing %>
Grazie mille a tutti!

).
Rispondi quotando