Salve a tutti..premetto che prima di postare ho cercato ovunque ed ho fatto tutti i tentativi possibili..dunque: ho questa pagina di scritta con i comportamenti server di dw..
la pagina interroga il db ed estrae un articolo e un' immagine iseriti dall'utente..
code:
--------------------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT"%><%Dim Recordset1__MMColParamRecordset1__MMColParam = "1"If (Request.QueryString("ID") <> "") Then Recordset1__MMColParam = Request.QueryString("ID")End If%><%Dim Recordset1Dim Recordset1_numRowsSet Recordset1 = Server.CreateObject("ADODB.Recordset")Recordset1.A ctiveConnection = MM_gelawebtvnews_STRINGRecordset1.Source = "SELECT * FROM gelawebtvnews WHERE ID = " + Replace(Recordset1__MMColParam, "'", "''") + ""Recordset1.CursorType = 0Recordset1.CursorLocation = 2Recordset1.LockType = 1Recordset1.Open()Recordset1_numRows = 0Dim MM_editCmdDim hitDim MM_editQueryif Recordset1.eof Then Response.Redirect("home.asp")response.end end ifIf CBool(Request.Cookies("gelawebtv")("News_" & Request.QueryString("id"))) = False Then ' incremento il campo hit di una unità hit = CInt(Recordset1.Fields.Item("hit").Value) + 1 ' aggiorno il db MM_editQuery = "UPDATE gelawebtvnews SET hit = " & hit & " WHERE id = " + Replace(Recordset1__MMColParam, "'", "''") + "" Set MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_gelawebtvnews_STRING MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close ' setto il cookie su True Response.Cookies("gelawebtv")("News_" & Request.QueryString("id")) = True Response.Cookies("gelawebtv").Expires = DateAdd("n", 30, Now())Elsehit = CInt(Recordset1.Fields.Item("hit").Value)End If%> <table width="440" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="140"><span class="Stile45"><span class="Stile55"><%=(Recordset1.Fields.Item("data") .Value)%> - <%=(Recordset1.Fields.Item("ora").Value)%> </span></span></td> <td width="30"><span class="Stile45"><span class="Stile10"><span class="Stile37"><span class="Stile8 Stile13 Stile19 Stile26 Stile49">[img]immagini/occhio.gif[/img]</span></span></span></span></td> <td width="20"><div align="left"></div> <div align="center"><span class="Stile45"><span class="Stile10"><span class="Stile37"><span class="Stile8 Stile13 Stile19 Stile26 Stile49"><%=(Recordset1.Fields.Item("hit").Value)%></span></span></span></span></div></td> <td width="20"></td> <td width="30"><div align="center">[img]immagini/stampa.gif[/img]</div></td> <td width="200"><div align="left"><span class="Stile45"><span class="Stile10"><span class="Stile37"><span class="Stile8 Stile13 Stile19 Stile26 Stile49"><span class="Stile50">stampa articolo </span></span></span></span></span></div></td> </tr> </table> <span class="Stile45">
<%=(Recordset1.Fields.Item("Titolo").Value)%></span></td> </tr> <tr> <td>[img]immagini/spazio10.gif[/img]</td> </tr> <tr> <td><div align="justify">[img]<%=(Recordset1.Fields.Item([/img]" align="left" class="spazio_foto"><span class="Stile46"><%=(Recordset1.Fields.Item("Notizi a").Value)%></span></div></td> </tr> <tr> <td></td> </tr> <tr> <td><span class="Stile10"><%=(Recordset1.Fields.Item("fonte" ).Value)%></span></td> </tr> <tr> <td height="40"></td> </tr> <tr> <td><form name="eMailer"> <div align="left"><span class="Stile37 Stile10"><span class="Stile53">Segnala ad un amico </span></span> <input type="text" name="address" size="20"> <input name="submit3" type="submit" class="pulsantino" onClick="mailThisUrl()" value="Segnala"> </div> </form></td> </tr> </table> </div></td> <td width="200" valign="top"><table width="190" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="200" valign="top" class="pannello_newsletter"><table width="175" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="30" valign="bottom" class="rientrotitolonewsletter"><span class="Stile7 Stile38">Newsletter</span></td> </tr> <tr> <td class="rientrotitolonewsletter">[img]immagini/spazio5.gif[/img]</td> </tr> <tr> <td class="rientrotitolonewsletter"><DIV align="left" class="Stile10"> <div align="justify" class="Stile37">Registrati per ricevere le ultime notizie direttamente sul tuo indirizzo di posta elettronica.
</div> </DIV></td> </tr> <tr> <td>[img]immagini/spazio5.gif[/img]</td> </tr> <tr> <td><form method="post" action="newsletter/iscrizione.asp"> <table width="170" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><div align="left"> <input name="email" type="text" class="pulsantino" size="25"> </div></td> </tr> <tr> <td><div align="left"> <input type="radio" name="azione" value="S" checked> <span class="Stile10 Stile37">iscrivimi</span></div></td> </tr> <tr> <td><div align="left"> <input type="radio" name="azione" value="N"> <span class="Stile10 Stile37">cancellami</span></div></td> </tr> <tr> <td height="30" valign="bottom"><div align="center"> <input name="submit2" type="submit" class="pulsantino" value=" Vai "> <label> <input name="Submit" type="reset" class="pulsantino" value="Reset"> </label> </div></td> </tr> </table> </form></td> </tr> </table>
--------------------------------------------------------------------------------
tutto è ok..il problema è che se un utente decide di non inserire un'immagine nella pagina appare il rettangolino bianco con la classica crocetta rossa..perchè giustamente il campo del db è vuoto..
Volevo sapere come modificare il codice in asp per far si che risolgo il problema.
Ho provato inserendo questa stringa
code:
--------------------------------------------------------------------------------
[img]/public/articoli/<%=foto%>[/img]
--------------------------------------------------------------------------------
code:
--------------------------------------------------------------------------------
<% end if %>
--------------------------------------------------------------------------------
ma dopo il titolo non mi fa visionare più nulla.
Per avere un idea più precisa potete visione il sito che sto cercando di realizzare
code:
--------------------------------------------------------------------------------
http://www.gelawebtv.com/home_new.asp

Rispondi quotando