salve
ho questo script un po particolare che mi visualizza a video tutti i vari campi foto presenti nel db .
<%
Dim nFoto : nFoto = 1
Dim nIndex
While nFoto<=40
%>
<table border="0" width="400" cellspacing="0" cellpadding="0">
<tr>
<%
nIndex = nFoto
While nIndex<nFoto+5
%><td><%
If trim(Rec("foto" & nIndex))="" Then
%>[img]5pixel.gif[/img]<%
Else
%>" rel="lightbox[fotoimmobile]">[img]../public/<%=rec([/img]" width="100" height="100" border="0" alt="" /><%
End If
%></td><%
nIndex = nIndex + 1
Wend
%>
</tr>
<tr>
<%
nIndex = nFoto
While nIndex<nFoto+5
%>
<td align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0" ID="Table2">
<tr>
<td width="50%"><input type="text" name="foto<%=nIndex%>" size="13" class="normales" value="<%=GetValue("foto" & nIndex,Rec("foto" & nIndex))%>" ID="Text1"></td>
<td width="50%"><a onclick="open('salvafoto<%=nIndex%>.htm','miniwin' ,'toolbar=yes,location=0,directories=0,status=0,me nubar=0,scrollbars=yes,resizable=0,width=500,heigh t=200')" href="javascript:void(0)">[img]salvafoto.gif[/img]</a></td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<%
nIndex = nIndex + 1
Wend
%>
</tr>
<tr>
<%
nIndex = nFoto
While nIndex<nFoto+5
%>
<td align="center">
<INPUT type="checkbox" NAME="Pubblica<%=nIndex%>" ID="Pubblica<%=nIndex%>" <%=GetCheck(nIndex,cod)%> value="1">
<label for="Pubblica<%=nIndex%>">Internet</label>
</td>
<%
nIndex = nIndex + 1
Wend
%>
</tr>
</table>
<table border="0" width="400" cellspacing="0" cellpadding="0" ID="Table3">
<tr>
<td>
</td>
</tr>
</table>
<%
nFoto = nFoto + 5
Wend
%>
<%
Function GetCheck(ByVal nIndex, ByVal nCodiceImmobile)
Dim oCon
Dim oRS
GetCheck = ""
Set oCon=Server.CreateObject("ADODB.Connection")
oCon.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& server.MapPath("/public/xxx.mdb")
Set oRS = oCon.Execute("select Pubblica from fotoimmobili where CodiceImmobile=" & nCodiceImmobile & " and Indice=" & nIndex)
If Not oRS.Eof Then
If oRS("Pubblica") Then GetCheck = "Checked"
End If
End Function
%>
In pratica calcola un ciclo di campi foto 1 2 3 4 .e via dicendo mettendomeli infine 5 x 8 righe totale 80 campi foto.
Dopo alcune ricerche ho trovato uno script interessante che mi rileva se c'è una x corrispondente alla foto di riferimento (quindi la foto non esiste) .
Esempio nel campo foto1 la foto si chiama foto1005_1.jpg e nn c'è anziche lasciare la x vorrei eliminarla grazie a questo script
'VISUALIZZO IMMAGINE
DIM percorso1, objFSO
percorso1 = ("public/" & rs("CAMPOIMMAGINE"))
nomeFile = server.mappath(percorso1)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
IF objFso.fileExists(nomeFile) THEN
response.write ("[img][/img]")
ESLE
response.write ("NESSUNA IMMAGINE")
END IF
Set objFSO = Nothing
come posso adattarlo al mio script fammi sapere grazie

Rispondi quotando
