Displaying Real-Time Guestbook Entries
Example
- Displaying a company suggestion box.
MGI Tags
- mgiGuestbook
- mgiFieldContent
- mgiFileInclude
- Guestbook Insertion Marker
Steps
- Create a form to collect suggestions.
- Name the form fields.
- Enter a form action and method.
- Save the form.
- Create a page to process the guestbook entry and display it.
- Save the display page and open it in a text editor.
- Insert the mgiGuestbook tag.
- Format the guestbook entry with text, HTML, mgiFieldContent tags and
other MGI tags.
- Insert the mgiFileInclude tag.
- Save the display page.
- Create a guestbook log page in a text editor.
- Insert the Guestbook Insertion Marker.
- Save the guestbook log page.
- FTP the guestbook form, display page and log page to the web server
running MGI.
- Complete and submit the guestbook form.
Step 1: Create a form to collect suggestions.
- Enter HTML form fields on a page using a graphic editor or text editor.
Enter a label and text field for Subject. Next, enter a Suggestion text
box with 7 rows and 50 columns. Finally, enter a submit button named "Submit
Suggestion". The following is an example guestbook form:
Step 2: Name the form fields.
- Name the text field and the text box with a unique name. For example,
name the text field "Subject" and the text box "Suggestion".
You may use capitalization and spaces in the form field names.
Step 3: Enter a form action and method.
- A form action sends guestbook information to a separate page for processing.
Enter the name of the display page (display.html) in the action parameter
of the <FORM> tag. Enter "post" in the method parameter
of the <FORM> tag. For example,
<FORM ACTION="display.html" METHOD="post">
...text field, text box, and submit button appears here...
</FORM>
Caution: A beginning and ending <FORM>
tag must enclose all form elements including text fields, text boxes and
buttons for the form to function properly. |
Step 4: Save the form.
- Save the guestbook form you have created.
Step 5: Create a page to process the guestbook entry and display it.
- Create a new page and enter the sentence "Thank you for your suggestions.
Each of the following suggestions will be carefully considered.".
Step 6: Save the display page and open it in a text editor.
- Save the display page and name it "display.html". Before
you proceed to the next step, open the display.html page in a text editor
(or in the HTML view of a graphic editor).
Caution: The display page name must match the
action parameter of the <FORM> tag that you entered on the guestbook
form page. |
Step 7: Insert the mgiGuestbook tag.
- Insert your cursor after the beginning <BODY> tag and enter the
beginning and ending mgiGuestbook tags. The beginning mgiGuestbook tag
has one required parameter (filelocation). In the "filelocation"
parameter, enter the name of the guestbook log text file (log.txt). For
example,
<mgiGuestbook fileLocation="log.txt">
...the format of the guestbook entry appears here...
</mgiGuestbook>
Tip: You must enter the mgiGuestbook tag before the mgiFileInclude
tag. The mgiGuestbook tag writes the entry to the log file. The mgiFileInclulde
tag displays the log file. |
Step 8: Format the guestbook entry with text, HTML, mgiFieldContent
tags and other MGI tags.
- Enter text, HTML (e.g., font colors), mgiFieldContent tags, and other
MGI tags (e.g., mgiDate) in the body of the mgiGuestbook tag. Each mgiFieldContent
tag displays the information from the guestbook form field that is specified
in the "name" parameter. The following is an mgiGuestbook tag,
text, HTML, and mgiFieldContent tags that format each guestbook entry.
<mgiGuestbook fileLocation="log.txt">
<P><B><mgiFieldContent name="Subject"></B></P>
<DL>
<DD><mgiFieldContent name="Suggestion">
</DL>
</mgiGuestbook>
Step 9: Insert the mgiFileInclude tag.
- The mgiFileInclude tag displays the guestbook log. To allow a visitor
to imemdiately view the guestbook entry that they submit, the mgiFileInclude
tag must be entered after the mgiGuestbook tags on the display page. Insert
your cursor after the header "Thank you for your suggestions. Each
of the following suggestions will be carefully considered" and enter
the mgiFileInclude tag and fileLocation parameter. In the "filelocation"
parameter, enter the name of the guestbook log text file (log.txt). For
example,
<mgiFileInclude fileLocation="log.txt">
Step 10: Save the display page.
- Save the changes you have made to the display page.
Step 11: Create a guestbook log page in a text editor.
- Create a new page in a text editing program to log each guestbook entry.
Step 12: Insert the Guestbook Insertion Marker.
- In the guestbook log page, only enter the Guestbook Insertion Marker.
The Guestbook Insertion Marker is written in the style of an HTML comment
that designates where new guestbook entries are displayed. Since this file
will be included in the Guestbook Display HTML page, <HTML>, <HEAD>
and <BODY> tags should not be included on the guestbook log file.
The following is a complete guestbook log file:
<!-- Guestbook Insertion Marker -->
Step 13: Save the guestbook log page.
- Save the guestbook log page and name it "log.txt".
Step 14: FTP the guestbook form, display page and log page to the web
server running MGI.
- Upload the guestbook form, display page, and log page from your local
computer to the web server using an FTP program.
Step 15: Complete and submit the guestbook form.
- Access the guestbook form in a browser. Complete and submit the form.
After you submit the form, the display page with the message "Thank
you for your suggestions. Each of the following suggestions will be carefully
considered" is displayed above your guestbook entry. Your guestbook
entry will appear similar to the following entry:
Refreshments for Visitors
I suggest that we add a free vend drink machine in the break
room. Given the number of business visitors to our office,
it would be helpful and courteous to offer them a choice
of refreshments.
- Newer guestbook entries appear before older guestbook entries.
|