gotFusion.com....... Where your adventure begins
Antons Video ProductionsNetObjects Fusion 7 Websites Portal

 


 

The GuestBook View
Now that we have created the Form, and the action
we can now setup the page to display the contents.
So far we have allowed the visitor to register a post to
the Guestbook. The Following steps will setup the Guestbook
Display section and will be what the visitor sees when clicking a
link to the Guestbook

NOTE: This is still the Action Page from the Previous tutorial

Create a table to House the Guestbook
Inside the Action Page create a 2 Column 5 Row Table
Apply your Css style tags to give the table the appearance you desire.
Select the table and click "HTML" from the properties Pallet
Inside the "Before the Tag" Section write the following
If you plan on copy and pasting this code first run it through NotePad to remove formatting

<%
rs.Open "select * from guestbook where [guestbook.ID] > 0  order by date,time DESC", connStrx, 3, 4
If Not rs.EOF Then
While Not rs.EOF

' This will reopen the Guestbook table and setup the display for the data using the table you created.
' Sorting it by the date and time posted. It also starts a looping process for our response.write
' statements and will create new tables for us to display more data.
%>



Inside the "After the Tag" section write the following
If you plan on copy and pasting this code first run it through NotePad to remove formatting

<%
response.write "<hr>"
rs.MoveNext
Wend
ELSE
Response.Write "The GuestBook is empty"
END IF
rs.close
set rs = nothing

' This will tell the script to get the next record and create a new table to display the data. It will use
' NetObjects Fusion code already written in the published page to create new tables for each record.
' Once it is finished, The database will close.
%>



Click "Okay" on the HTML Dialog Box

Next we what to start inserting the response.write tags inside the table cells for data display

Dbl Click Cell 2 of Row 1 to bring up the cursor
Press Ctrl+T to bring up the tag dialog box.
Insert the following code
If you plan on copy and pasting this code first run it through NotePad to remove formatting

<%
response.write rs("date") & ", " & rs("time")
%>



Dbl Click Cell 2 of Row 2 to bring up the cursor
Press Ctrl+T to bring up the tag dialog box.
Insert the following code
If you plan on copy and pasting this code first run it through NotePad to remove formatting

<%
response.write "<a href='mailto:" & rs("email") & "'> & rs("name") & "</a>"
' This will combine the email address and Posters name as a link
%>



Dbl Click Cell 2 of Row 3 to bring up the cursor
Press Ctrl+T to bring up the tag dialog box.
Insert the following code
If you plan on copy and pasting this code first run it through NotePad to remove formatting

<%
response.write rs("city") & ", " & rs("state") & "... " & rs("country")
' This will combine the city, state and country fields to a single string
%>



Dbl Click Cell 2 of Row 4 to bring up the cursor
Press Ctrl+T to bring up the tag dialog box.
Insert the following code
If you plan on copy and pasting this code first run it through NotePad to remove formatting

<%
IF mid(trim(rs("homepage")),1,7) = "http://" then
response.write "<a href='" & rs("homepage") & "' target='blank'> & rs("homepage") & "</a>"

else

response.write "<a href='http://" & rs("homepage") & "'  target='blank'> & rs("homepage") & "</a>"
end if

' This will first check the homepage value for the proper html syntax for a
' link and fix it if, it does not contain a http:// statement in the data.
' It will then create a link from the Homepage data.
%>



Dbl Click Cell 2 of Row 5 to bring up the cursor
Press Ctrl+T to bring up the tag dialog box.
Insert the following code
If you plan on copy and pasting this code first run it through NotePad to remove formatting

<%
' The input from the message field when submitted can contain line
' feeds that were saved at submission.
' In order to display the text as it was written we need to convert the vb
' line feeds into <br> values so they are viewable in the final viewing of
'  the data.

' We must also convert any dbl quotes ( " ) encountered to single
' quotes ( ' ). If we do not, errors can occur and disable the view


fh2 = trim(rs("message"))
fhc2 = replace( fh2, VBcrlf, "<br>")
fhc3 = replace( fhc2, chr(34), "'" )
response.write fhc3
%>



Once this is finished, Add a link to Sign the GuestBook
 using the Sign-Book.html page created earlier. To finish,
Publish all pages to your server including an initial publish of
the guestbook.mdb and enjoy the feedback from your site

View the PREVIOUS page in this tutorial

Return to the TOP of this page


|  Fusion  |  Web Design  |  Hosting  |  Resources  |  gotFusion Store  | 

Problems with this page?  

All content copyright © 2002 gotFusion LLC.  The name gotFusion and the gotFusion ® logo are registered trademarks of gotFusion LLC
Copyright, legal notice & privacy statement