Setting Boolean Variables
Example
- Setting the value of a "Specials" boolean database field
in a variable.
MGI Tags
Steps
- Open the database results template file in a text editor.
- Insert the mgiSet tag.
- Save the database results template file.
- FTP the database results template file to a web server running MGI.
- Perform a database search.
Step 1: Open the database results template file in a text editor.
- Open the database results template file in a text editing program that
allows you to view and modify HTML.
Step 2: Insert the mgiSet tag.
- Only a site variable can be set as a boolean type. The boolean variable
type can contain the values "True" and "False".
-
- Insert the beginning mgiSet tag, name parameter, type parameter and
scope parameter and the ending mgiSet tag. In the name parameter, enter
the variable name. Use a unique name for each variable. In the type parameter,
enter "Boolean". In the scope parameter, enter "Site".
A site variable is stored in a database and is available at all levels
of a site. Any information between the beginning mgiSet tag and the ending
mgiSet tag is the value of the variable. Enter an mgiGet tag and name parameter
in the body of the mgiSet tags. In the name parameter, enter the database
field name.
-
- Once set, the value of the boolean variable can be used in conditional
comparisons.
<mgiSet name="Sale" type="Boolean" scope="Site">
<mgiGet name="Specials">
</mgiSet>
<mgiConditional lhs={mgiGet name="Sale"} relationship="equals"
rhs="True" then="Weekly Special!">
Step 3: Save the database results template file.
- Save the changes you have made to the results template file.
Step 4: FTP the database results template file to a web server running
MGI.
- Upload the results template file from your local computer to the web
server using an FTP program.
Step 5: Perform a database search.
- Perform a database search that uses the results template file to display
results. For each record that is returned, a site variable containing the
"True" or "False" value stored in the "Specials"
database field is set. Based on the value of the variable (True or False),
the message "Weekly Special!" is displayed.
|