The mgiSet Tag
The mgiSet tag is used to set a variable with a specified
scope and value.
The mgiSet tag has a beginning tag with one required parameter
and 3 optional parameters, a body, and an ending tag. The tag
<mgiSet name="Name" scope="Page/Site" type="Variable Type"
- name="Name" where "Name" is the
unique name of the variable to be set.
- scope="Page" or "Site" where "Page"
indicates that the variable is only available for the page on
which the mgiSet tag resides and "Site" indicates that
the variable is globally available for any page or level of the
web site. Site variables are stored in an MGI database. The default
scope is "Page".
- type="Variable Type" where "Variable
Type" is the type of variable that is set. Valid types include
"Number" (stores integer and decimal numbers), "Boolean"
(stores true and false values), and 'Text" (stores alpha-numeric
characters). The default value is "Text". Page variables
are always set as "Text", but are converted to "Number"
when used in numerical comparisons.
- defaultValue="Value" where "Value"
is the text that will be set if the tag body is blank.
- The body of the mgiSet tag is the value of the variable.
Example Usage and Output
<mgiSet name="Color" scope="Page">
In this example, the color of an item is set as a page variable.
Further down the page, the value of the variable (the item color)
is used in an mgiIf comparison to display the price of the item
based on the chosen color.