Visualizzazione dei risultati da 1 a 6 su 6

Discussione: Dreamweaver & Replace

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    74

    Dreamweaver & Replace

    Salve ragazzi,
    sono un dilettante e uso il Dreamweaver per gestire un sito che ho fatto, non so modificare il linguaggio asp tranne che per piccole sciocchezze.

    ora, leggendo nel forum ho capito come fare per mandare a capo i testi inseriti in un database (form = Replace(form, vbCrLf, "
    ").

    Il problema è: con un codice creato in automatico da DW, dove vado ad inserire la stringa??

    Help!!!

  2. #2
    Bisognerebbe vedere il codice e poi possiamo dirti dove inserire la riga.
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    74
    Eccolo, questa è la pagina del form, so che si deve inserire in questa pagina, vero???


    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

    <%
    ' *** Edit Operations: declare variables

    Dim MM_editAction
    Dim MM_abortEdit
    Dim MM_editQuery
    Dim MM_editCmd

    Dim MM_editConnection
    Dim MM_editTable
    Dim MM_editRedirectUrl
    Dim MM_editColumn
    Dim MM_recordId

    Dim MM_fieldsStr
    Dim MM_columnsStr
    Dim MM_fields
    Dim MM_columns
    Dim MM_typeArray
    Dim MM_formVal
    Dim MM_delim
    Dim MM_altVal
    Dim MM_emptyVal
    Dim MM_i

    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
    End If

    ' boolean to abort record edit
    MM_abortEdit = false

    ' query string to execute
    MM_editQuery = ""
    %>
    <%
    ' *** Insert Record: set variables

    If (CStr(Request("MM_insert")) = "form2") Then

    MM_editConnection = MM_Conn_Hattrick_STRING
    MM_editTable = "guestbook"
    MM_editRedirectUrl = "guestbook.asp"
    MM_fieldsStr = "Data|value|Utente|value|Squadra|value|Commento|va lue"
    MM_columnsStr = "Data|',none,NULL|Utente|',none,''|Squadra|',none, ''|Commento|',none,''"

    ' create the MM_fields and MM_columns arrays
    MM_fields = Split(MM_fieldsStr, "|")
    MM_columns = Split(MM_columnsStr, "|")

    ' set the form values
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
    Next

    ' append the query string to the redirect URL
    If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
    End If

    End If
    %>
    <%
    ' *** Insert Record: construct a sql insert statement and execute it

    Dim MM_tableValues
    Dim MM_dbValues

    If (CStr(Request("MM_insert")) <> "") Then

    ' create the sql insert statement
    MM_tableValues = ""
    MM_dbValues = ""
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
    MM_formVal = MM_emptyVal
    Else
    If (MM_altVal <> "") Then
    MM_formVal = MM_altVal
    ElseIf (MM_delim = "'") Then ' escape quotes
    MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
    Else
    MM_formVal = MM_delim + MM_formVal + MM_delim
    End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
    MM_tableValues = MM_tableValues & ","
    MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
    Next
    MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

    If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If

    End If
    %>
    <%
    Dim Rs_guestbook
    Dim Rs_guestbook_numRows

    Set Rs_guestbook = Server.CreateObject("ADODB.Recordset")
    Rs_guestbook.ActiveConnection = MM_Conn_Hattrick_STRING
    Rs_guestbook.Source = "SELECT * FROM guestbook ORDER BY ID DESC"
    Rs_guestbook.CursorType = 0
    Rs_guestbook.CursorLocation = 2
    Rs_guestbook.LockType = 1
    Rs_guestbook.Open()

    Rs_guestbook_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index

    Repeat1__numRows = 3
    Repeat1__index = 0
    Rs_guestbook_numRows = Rs_guestbook_numRows + Repeat1__numRows
    %>

    <%
    ' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

    Dim Rs_guestbook_total
    Dim Rs_guestbook_first
    Dim Rs_guestbook_last

    ' set the record count
    Rs_guestbook_total = Rs_guestbook.RecordCount

    ' set the number of rows displayed on this page
    If (Rs_guestbook_numRows < 0) Then
    Rs_guestbook_numRows = Rs_guestbook_total
    Elseif (Rs_guestbook_numRows = 0) Then
    Rs_guestbook_numRows = 1
    End If

    ' set the first and last displayed record
    Rs_guestbook_first = 1
    Rs_guestbook_last = Rs_guestbook_first + Rs_guestbook_numRows - 1

    ' if we have the correct record count, check the other stats
    If (Rs_guestbook_total <> -1) Then
    If (Rs_guestbook_first > Rs_guestbook_total) Then
    Rs_guestbook_first = Rs_guestbook_total
    End If
    If (Rs_guestbook_last > Rs_guestbook_total) Then
    Rs_guestbook_last = Rs_guestbook_total
    End If
    If (Rs_guestbook_numRows > Rs_guestbook_total) Then
    Rs_guestbook_numRows = Rs_guestbook_total
    End If
    End If
    %>
    <%
    ' *** Recordset Stats: if we don't know the record count, manually count them

    If (Rs_guestbook_total = -1) Then

    ' count the total records by iterating through the recordset
    Rs_guestbook_total=0
    While (Not Rs_guestbook.EOF)
    Rs_guestbook_total = Rs_guestbook_total + 1
    Rs_guestbook.MoveNext
    Wend

    ' reset the cursor to the beginning
    If (Rs_guestbook.CursorType > 0) Then
    Rs_guestbook.MoveFirst
    Else
    Rs_guestbook.Requery
    End If

    ' set the number of rows displayed on this page
    If (Rs_guestbook_numRows < 0 Or Rs_guestbook_numRows > Rs_guestbook_total) Then
    Rs_guestbook_numRows = Rs_guestbook_total
    End If

    ' set the first and last displayed record
    Rs_guestbook_first = 1
    Rs_guestbook_last = Rs_guestbook_first + Rs_guestbook_numRows - 1

    If (Rs_guestbook_first > Rs_guestbook_total) Then
    Rs_guestbook_first = Rs_guestbook_total
    End If
    If (Rs_guestbook_last > Rs_guestbook_total) Then
    Rs_guestbook_last = Rs_guestbook_total
    End If

    End If
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Federazione del Litorale Romano - Libro degli Ospiti -</title>
    <meta name="description" content="Pagina ufficiale della Federazione del Litorale Romano, essa riunisce tutti gli iscritti al gioco online Hattrick (www.hattrick.org) che sono supporter e sono nati, abitano o frequentano il Litorale Romano">
    <meta name="keywords" content="hattrick,federazione,litorale,romano,supp orter,online,gioco,calcio,federazione del litorale romano,federazione litorale,litorale romano,ostia,nettuno,fregene">

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    <!--
    body,td,th {
    font-family: Times New Roman, Times, serif;
    font-size: 12px;
    color: #000000;
    }
    body {
    background-color: #FFFFFF;
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    }
    a {
    font-size: 12px;
    color: #000066;
    }
    a:visited {
    color: #000066;
    }
    a:hover {
    color: #FF0000;
    }
    a:active {
    color: #FF0000;
    }
    -->
    </style></head>

    <body>
    <table width="900" border="0" align="center" cellpadding="0" cellspacing="0">

    <tr>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    <tr>
    <td rowspan="2" align="left" valign="top">[img]images/index_r1_c1.gif[/img]</td>
    <td>[img]images/index_r1_c2.jpg[/img]</td>
    <td>[img]images/index_r1_c3.jpg[/img]</td>
    <td colspan="2">[img]images/index_r1_c4.jpg[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    <tr>
    <td colspan="3" rowspan="2" valign="top" background="images/index_r2_c2.jpg"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td><div align="center">
    <h3>Firma il Libro degli Ospiti </h3>
    </div></td>
    </tr>
    <tr>
    <td><form name="form1" id="form1" action="">
    </form>
    <form method="post" action="<%=MM_editAction%>" name="form2">
    <table align="center">
    <tr valign="baseline">
    <td nowrap align="right">Manager:</td>
    <td>
    <input type="text" name="Utente" size="32" />
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Squadra:</td>
    <td>
    <input type="text" name="Squadra" value="" size="32">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Commento:</td>
    <td>
    <textarea name="Commento" cols="32" wrap="VIRTUAL"></textarea>
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right"></td>
    <td>
    <input type="submit" value="Firma il Libro degli Ospiti">
    </td>
    </tr>
    </table>
    <input type="hidden" name="Data" value="<%=Now()%>" size="32">
    <input type="hidden" name="MM_insert" value="form2">
    </form>


    </p></td>
    </tr>
    </table> <p align="center"></p>
    <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
    <%
    While ((Repeat1__numRows <> 0) AND (NOT Rs_guestbook.EOF))
    %>
    <tr>
    <td>Messaggio n&deg;<%=(Rs_guestbook.Fields.Item("ID").Value)%> di <%=(Rs_guestbook_total)%> del <%=(Rs_guestbook.Fields.Item("Data").Value)%></td>
    </tr>
    <tr>
    <td>Scritto da <%=(Rs_guestbook.Fields.Item("Utente").Value)%> manager de &quot; <%=(Rs_guestbook.Fields.Item("Squadra").Value)%>&quot;</td>
    </tr>
    <tr>
    <td><table width="100%" border="01" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
    <tr>
    <td><%=(Rs_guestbook.Fields.Item("Commento").Value)% ></td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td><div align="center">


    ---------------------------------------------------------------------------------------------------</p>
    </div></td>
    </tr>
    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    Rs_guestbook.MoveNext()
    Wend
    %>
    </table>
    <p align="center"></p>
    <p align="center">Leggi tutti i messaggi.</p></td>
    <td rowspan="2" align="center" valign="top" background="images/index_r2_c5.jpg"></td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    <tr>
    <td align="center" valign="top" background="images/index_r3_c1.jpg"></td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    <tr>
    <td colspan="5" background="images/index_r4_c1.jpg"></td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    </table>
    </body>
    </html>
    <%
    Rs_guestbook.Close()
    Set Rs_guestbook = Nothing
    %>

  4. #4
    codice:
     <td><%=(replace(Rs_guestbook.Fields.Item("Commento").Value,vbcrlf,"
    ")%></td>

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    74
    Niente, mi dà questo errore:


    Tipo di errore:
    Errore di compilazione di Microsoft VBScript (0x800A03EE)
    Previsto ')'
    /flr3.0/ins_guestbook2.asp, line 331, column 82
    Response.Write((replace(Rs_guestbook.Fields.Item(" Commento").Value,VbcrLf,"
    "))

  6. #6
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    74
    Ho risolto!!!!!!!
    grazie, mancava una parentesi:

    <td><%=(replace(Rs_guestbook.Fields.Item("Commento").V alue,VbcrLf,"
    "))%>
    </td>

    siete stati gentilissimi, spero di poter ricambiare in futuro... Magari quando diventerò più bravo..

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.