The mgiGuestbookDB Tag
Tag Behavior
Use the mgiGuestbookDB tag to create a guestbook with entries
stored in a database.
Tag Syntax
The mgiGuestbookDB tag has three modes. Each mode has different
required and optional parameters. The modes of mgiGuestbookDB
are:
- submit - Submits the guestbook entry to the database.
- display - Displays the guestbook entries from the
database.
- submitAndDisplay - Submits the guestbook entry to
the database and displays the guestbook entries from the database.
Submit Mode
The submit mode of the mgiGuestBookDB tag has a beginning
tag with two required parameters and three optional parameters,
a body, and an ending tag. The tag form is:
<mgiGuestbookDB name="myGuestbook" mode="submit"
odbcDatasource="Source Name" odbcUsername="Name"
odbcPassword="Password">
MGI Tags and Text
</mgiGuestbookDB>
Required Parameters:
- name - The name of the guestbook.
- mode - The mode is the function that the mgiGuestbookDB
tag performs. In "submit" mode, the mgiGuestbookDB
tag adds the guestbook entry to the guestbook database. In submit mode, the body of the mgiGuestbookDB
tag is required and cannot be empty.
Optional Parameters:
- odbcDatasource (NT only) - The odbcDatasource is the name of
datasource on the server that provides access information for
an external ODBC database. If the odbcDatasource parameter is
included, counter information will be stored in the specified
ODBC database rather than the internal MGI database. Inquire
with the server administrator for additional information about
the use of ODBC databases. If you include
the odbcDatasource parameter, the odbcUsername and odbcPassword
parameters are required.
- odbcUsername (NT only) - The odbcUsername is the username required
to access the ODBC datasource. The odbcUsername
parameter is required if you include the odbcDatasource parameter.
- odbcPassword (NT only) - The odbcPassword is the code required
to access the ODBC datasource. The odbcPassword
parameter is required if you include the odbcDatasource parameter.
Display Mode
The display mode of the mgiGuestBookDB tag has a beginning
tag with one required parameter and seven optional parameters,
and an ending tag. The tag form is:
<mgiGuestbookDB name="myGuestbook" mode="display"
resultsPerPage="Whole Number" page="Whole Number"
resultsVariableName="Name" odbcDatasource="Source Name"
odbcUsername="Name" odbcPassword="Password">
</mgiGuestbookDB>
Required Parameters:
- name - The name of the guestbook.
Optional Parameters:
- mode - The mode is the function that the mgiGuestbookDB
tag performs. In "display" mode, the mgiGuestbookDB
tag displays guestbook entries from the guestbook database at
the location of the mgiGuestbookDB tag. "Display" is
the default mode of the mgiGuestbookDB tag.
- resultsPerPage - The resultsPerPage is the number
of guestbook entries to display. The default value is 25.
- page - The page is the set of guestbook entries to
display. For example, if the resultsPerPage is set to "25",
then page 1 displays entries 1 to 25 and page 2 displays entries
26 to 50. The default value is 1.
- resultVariableName - The resultVariableName is the
name prepended to the guestbook result variables that contain
information about the guestbook results. You may choose any name
for the result variable prefix. To display guestbook result variables
use the mgiGet tag. In the following
list of available result variables, the resultVariableName value
is "resultvar". Result variables are created
and available anywhere on the page after the mgiGuestbookDB tag.
- resultvar_ResultCount - A page variable with the total
number of entries in the guestbook.
- resultvar_FirstIndex - A page variable with the index
number of the first entry shown on the page.
- resultvar_LastIndex - A page variable with the index
number of the last entry shown on the page.
- resultvar_PrevPage - A page variable with the number
of the page preceding the current page. The value of this variable
is zero (0) if the current page is 1.
- resultvar_Page - A page variable with the number of
the page currently displaying.
- resultvar_NextPage - A page variable with the number
of the page following the current page. The value of this variable
is zero (0) if the current page is the last page.
- odbcDatasource (NT only) - The odbcDatasource is the name of
datasource on the server that provides access information for
an external ODBC database. If the odbcDatasource parameter is
included, counter information will be stored in the specified
ODBC database rather than the internal MGI database. Inquire
with the server administrator for additional information about
the use of ODBC databases. If you include
the odbcDatasource parameter, the odbcUsername and odbcPassword
parameters are required.
- odbcUsername (NT only) - The odbcUsername is the username required
to access the ODBC datasource. The odbcUsername
parameter is required if you include the odbcDatasource parameter.
- odbcPassword (NT only) - The odbcPassword is the code required
to access the ODBC datasource. The odbcPassword
parameter is required if you include the odbcDatasource parameter.
SubmitAndDisplay Mode
The submitAndDisplay mode of the mgiGuestBookDB tag has a
beginning tag with two required parameters and six optional parameters,
a body, and an ending tag. The tag form is:
<mgiGuestbookDB name="myGuestbook" mode="display"
resultsPerPage="Whole Number" page="Whole Number"
resultsVariableName="Name" odbcDatasource="Source Name"
odbcUsername="Name" odbcPassword="Password">
MGI Tags and Text
</mgiGuestbookDB>
Required Parameters:
- name - The name of the guestbook.
- mode - The mode is the function that the mgiGuestbookDB
tag performs. In "submitAndDisplay" mode, the
mgiGuestbookDB tag adds the guestbook entry to the guestbook
database and displays guestbook entries from the guestbook database
at the location of the mgiGuestbookDB tag.
In submitAndDisplay mode, the body of the mgiGuestbookDB tag
is required and cannot be empty.
Optional Parameters:
- resultsPerPage - The resultsPerPage is the number
of guestbook entries to display. The default value is 25.
- page - The page is the set of guestbook entries to
display. For example, if the resultsPerPage is set to "25",
then page 1 displays entries 1 to 25 and page 2 displays entries
26 to 50. The default value is 1.
- resultVariableName - The resultVariableName specifies
the type of information that is saved in a page variable. If
the resultVariableName parameter value is "resultvar",
then the following page variables are created and available anywhere
on the page after the mgiGuestbookDB tag (Use the mgiGet
tag to display variable information.)
- resultvar_ResultCount - A page variable with the total
number of entries in the guestbook.
- resultvar_FirstIndex - A page variable with the index
number of the first entry shown on the page.
- resultvar_LastIndex - A page variable with the index
number of the last entry shown on the page.
- resultvar_PrevPage - A page variable with the number
of the page preceding the current page. The value of this variable
is zero (0) if the current page is 1.
- resultvar_Page - A page variable with the number of
the page currently displaying.
- resultvar_NextPage - A page variable with the number
of the page following the current page. The value of this variable
is zero (0) if the current page is the last page.
- odbcDatasource (NT only) - The odbcDatasource is the name of
datasource on the server that provides access information for
an external ODBC database. If the odbcDatasource parameter is
included, counter information will be stored in the specified
ODBC database rather than the internal MGI database. Inquire
with the server administrator for additional information about
the use of ODBC databases. If you include
the odbcDatasource parameter, the odbcUsername and odbcPassword
parameters are required.
- odbcUsername (NT only) - The odbcUsername is the username required
to access the ODBC datasource. The odbcUsername
parameter is required if you include the odbcDatasource parameter.
- odbcPassword (NT only) - The odbcPassword is the code required
to access the ODBC datasource. The odbcPassword
parameter is required if you include the odbcDatasource parameter.
Example Usage and Output
Submit Mode
<mgiGuestbookDB name="myGuestbook" mode="submit">
<p><b><mgiPostArgument name="Name"> said:</b></p>
<p><mgiPostArgument name="Comments"></p>
<p><hr></p>
</mgiGuestbookDB>
In this example, a guestbook entry is added to the guestbook
database from a form submission.
Display Mode
<mgiGuestbookDB name="myGuestbook" mode="display"
resultsPerPage="20" page="2">
</mgiGuestbookDB>
In this example, the guestbook entries from 21 to 40 are displayed.
If the guestbook entries were submitted as in the submit mode
example, they would appear as follows:
Ralph Barber said:
I prefer your products because they are easy to learn and
use
Marcia Simpson said:
Does your product come in blue?
SubmitAndDisplay Mode
<mgiGuestbookDB name="myGuestbook" mode="submitAndDisplay"
resultsPerPage="20" page="2">
<p><b><mgiPostArgument name="Name"> said:</b></p>
<p><mgiPostArgument name="Comments"></p>
<p><hr></p>
</mgiGuestbookDB>
In this example, new guestbook entries from a form submission
are submitted to the guestbook database as in the submit mode
example and displayed as in the display mode example.
Suggested Usage
- Database-Driven Guestbooks
|