Using the available options your guestbook can be customized to meet most of your needs. The process is far from perfect, but if you find you can't get things to work the way you want there are numerous other free guestbook scripts that you can use. These are the available options...
Note that changing the format strings in the form will not change entries already in the guestbook.
You can format each entry from the guestbook form by embedding a special command as part of the field name. The command starts with _fmt_ and specifies HTML to be embedded into the entry. Since it is specified as part of the field name, each field can have a different format. The general form is:
name="Normal field name _fmt_xxx_yyy_zzz"
The beginning part is the regular name of the field, like "Guest name" in the simple example form given on the previous page. The "_fmt_" lets the script know you're about to start the format specifications. "xxx" is where you put HTML code to include before the field name. "yyy" should be HTML that goes between the name and what the user entered in that field. Finally, "zzz" is what you want after the field contents.
For example, you might try italicizing the field name and putting a break on the end of the line like this:
Your name: <input type=text name="Guest name _fmt_<i>_</i>:_<br>">
Once again, let's assume the visitor puts "Morgan" in the "Guest name" field. The script would end up generating a line of HTML in the guestbook like this:
<i>Guest name</i>: Morgan
Please note that you should use both _ in the format string even if you're only inserting one or two things. For example, let's say your last field is a comment field that can be quite long and you'd rather put the field contents on the next line after the name. You could use:
In this case, there are two _ in a row after the "fmt", indicating that the script is to insert nothing before the field name.
You may want to turn the contents of the field into a hyperlink or otherwise use the contents in your HTML code you're embedding as a format. If you include \CONTENTS in your format string, the script will substitute the field contents at that point. For example, if the user is supposed to put the URL of their own home page, we could make the field a clickable link by specifying the field like this:
Your home page: <input type=text name="Web site _fmt__<a href=^\CONTENTS^>_</a><br>">
This would surround the URL with the HTML tags that create a clickable link to that URL. Remember that there are two _ after the fmt, since there is nothing being inserted before the field name. Also, notice that the href tag has a ^ symbol where you'd expect a " mark. This is because you can't use a " inside a field name, since that is delimited by " already. guestbook.cgi looks for any ^ inside the field name and replaces it with the proper " mark.
Here's a complex example that formats a user's email address as a mailto link, while boldfacing the field name and putting a ": " between the name and the field contents, along with a line break at the end:
Your email address: <input type=text name="email _fmt_<b>_</b>: <a href=^mailto:\CONTENTS^>_</a><br>">
Time and Date
If you want to capture the date and time the guestbook entry was created, you can create a hidden field that has the phase "insert-date-time" at the beginning of the value field. For example:
<input type=hidden name="Date of visit" value="insert-date-time _month_ _day_">;
This creates a guestbook line that has "Date of visit" and the month and day. Other date/time parts you can use are:
_wday_: Day of the week, Monday - Sunday _year_: The current year _time_: The clock time, in hours:minutes am/pm
You can also use the format string at the same time, so an entry like this in your form:
<input type=hidden name="Date _fmt__: _" value="insert-date-time _wday_, _month_ _day_, _time_<br>">will produce a line like:
guestbook.cgi creates this line in order with the rest of the fields, so if you include it before other fields, it will appear first. Likewise, if it's the last field defined in the form, it will appear at the bottom of the guestbook entry.
guestbook.cgi has certain default behaviors that can be modified by creating a file named guestbook.cf. Each line in the file specifies the value for an option. Lines that start with a # symbol are treated as comments and ignored. The general form for each line is: option=value
The options the user can set are:
separator Specifies the HTML code to put between each visitor entry. You could use this, for example, to tell the script to insert a graphic between each entry. Note that that changing this will not change separators between old entries. Defaults to separator=<hr>
header Tells guestbook.cgi to create the top of the guestbook (everything before the actual entries) from a file you have, rather than the generic one it generates. This would allow you to incorporate your own graphics, etc, to keep the guestbook stylistically in line with the rest of your site. This can be changed at any time and the guestbook will be modified on the next entry. If not specified, the script uses:<html> <head><title>My Guestbook</title></head> <body> <h1>Welcome to my guestbook</h1> <hr>
footer Tells guestbook.cgi to create the bottom of the guestbook (everything after the actual entries) from a file you have, rather than the generic one it generates. As with the header option, this would allow you to incorporate your own graphics, etc, to keep the guestbook stylistically in line with the rest of your site. This can be changed at any time and the guestbook will be modified on the next entry. If not specified, the script generates this default:</body> </html>
booktype For security reasons, guestbook.cgi will only create a guestbook file named guestbook.html. However, you may want to use Server Side Include commands in the header or footer files. In that case, you can specify booktype=shtml and the script will generate a guestbook named guestbook.shtml. Note that adding this later will result in a new guestbook being created unless you rename the old file to the new name first.
responsefile After adding the guestbook entry, the guestbook.cgi script normally displays a generic message of thanks with a clickable link to the guestbook. You can use the responsefile option to have the script send out a file you choose instead.
email Controls if and where the script will send email to when the guestbook is updated. The value can be a single address or multiple addresses separated by commas. See the example in the sample guestbook.cf below. There are two forms:
email=notify list sends a simple notification that the guestbook has been updated to each address in list.
email=copyto list This sends sends a copy of the new entry to each address in list.
Here's an example guestbook.cf:
# my guestbook config file # these lines that start with # are ignored separator=<img src="/images/marblebar.gif"> header=guestbook.top footer=guestbook.btm responsefile=guestbook.rsp email=notify firstname.lastname@example.org, email@example.com