Kaye and Geoff's web page documentation 

Guestbook files

There are three guestbook files: a header, a body and a footer, named cgi_guestbook_head.html, cgi_guestbook_body.html and cgi_guestbook_foot.html. This approach separates out the unchanging parts of the HTML (header and footer) from the part which is updated. This makes editing the body easier since each new entry can just be appended rather than inserted.

cgi_guestbook_head.html

The header starts with a HTTP directive required by the web server (a MIME type which tells it what sort of information is being provided) followed by a blank line (required) and then has the HTML to start the guestbook page. The HTML initiates a table for which the body is just a series of rows.

Content-type: text/html <html> <head><title>Guestbook</title></head> <body bgcolor="#ffeedd"> <center> <h2>K and G's guestbook</h2> </center> <hr> <table cellpadding="0" cellspacing="0" width="100%" border="1"> <tr> <th>Date</th><th>Name</th><th>Country</th><th>Organisation</th><th>Comments</th> </tr>

cgi_guestbook_body.html

The body is built by the CGI which writes the guestbook. Each one line entry is a row in a table. It often pays to set these files up with a 'dummy' entry (which you would do as part of the testing process anyway) before the real entries are made just in case there is some sort of operating system IO error when the file is empty. In the sample below the lines are broken in the centre purely for display reasons - so that hopefully the web page can be viewed without horizontal scrolling.

<tr><td>Tue Jan 21 15:26:24 WAUST 1997</td><td>Mary Smith</td><td>Oz</td> <td>ecu</td><td>great pages! wish I had pages as good as this</td></tr> <tr><td>Tue Jan 21 15:30:35 WAUST 1997</td><td>Bert Jones</td><td>NZ</td> <td>Auckland Uni</td><td>Mary put me onto your pages - good stuff</td></tr> <tr><td>Tue Jan 21 15:31:34 WAUST 1997</td><td>Fred Nurke</td><td>USA</td> <td>Notre Dame</td><td>OK! Mary Smith and Bert Jones were right</td></tr> <tr><td>Tue Jan 21 15:32:32 WAUST 1997</td><td>Bud Clarke</td><td>UK</td> <td>none</td><td>Mary is wrong. They are terrible pages!</td></tr>

cgi_guestbook_foot.html

The footer just finishes off the HTML

</body> </html>
Top
Close