The mgiInlineIf Tag

Tag Behavior

Use the mgiInlineIf tag to perform a conditional comparison and display a result based upon the outcome of the comparison (see also mgiIf and mgiSwitch).


Tag Syntax

The mgiInlineIf tag has four required parameters and three optional parameter. The tag form is:

<mgiInlineIf lhs="Comparison Value" relationship="Relationship" 
rhs="Comparison Value" then="True" else="False" order="Order" 
caseSensitive="Yes/No">

Required Parameters:

  • lhs - The lhs is the first value tested in the conditional comparison (i.e., the "left hand side" of the comparison). The lhs value must be a number for the greaterThan, greaterThanOrEqualTo, lessThan, and lessThanOrEqualTo relationships. In order to use special reserved characters such as tabs, backslashes, and ASCII characters, you must use the appropriate Escaped String format.
  • relationship - The realtionship is the type of comparison to perform. You may use the relationship name or symbol. Valid relationships include:
    • lessThan (<)
    • lessThanOrEqualTo (<=)
    • greaterThan (>)
    • greaterThanOrEqualTo (>=)
    • equals (=)
    • doesNotEqual (<>)
    • contains
    • doesNotContain
    • beginsWith
    • doesNotBeginWith
    • endsWith
    • doesNotEndWith
    • isEmpty - The rhs parameter is not required for this relationship.
    • isNotEmpty - The rhs parameter is not required for this relationship.
  • rhs - The rhs is the second value tested in the conditional comparison (i.e., the "right hand side" of the comparison). In order to use special reserved characters such as tabs, backslashes, and ASCII characters, you must use the appropriate Escaped String format.
  • then - Then then value is the text that displays if the conditional comparison is true.

Optional Parameters:

  • else - Then else value is the text that displays if the conditional comparison is false.
  • order - The order determines the order of values in the conditional comparison. If the order parameter value is "alphabetical", then values are compared alphabetically as ascii strings (i.e., characters appear alphabetically in the order of non-printable characters, punctuation, numbers, capital letters, and lower-case letters). Therefore, if two numbers are compared alphabetically as strings, they are ordered from left to right alphabetically (e.g., "550" appears alphabetically before "60"). If the order parameter value is "numerical", then number values are compared numerically from the decimal. If either value is not a number in a numerical order, then the values are compared alphabetically as strings. The default value is "numerical".
  • caseSensitive - The caseSensitive parameter specifies whether the lhs and rhs values are checked for case-sensitivity. If the caseSensitive parameter value is "Yes", the lhs and rhs values are checked for case-sensitivity. If the caseSensitive parameter values is "No", the lhs and rhs values are not checked for case-sensitivity. The default value is "No".


Example Usage and Output

<mgiInlineIf lhs={mgiGetCookie name="Subscription"} 
relationship="contains" rhs={mgiDate format="longMonth"}  
then="Renew your subscription today!" 
else="Thank you for your support.">

In this example, a visitor's subscription cookie is checked for the current date. If their subscription contains the current month, then the visitor is prompted to renew, otherwise a thank you message is displayed.


Suggested Usage

  • Conditional Comparisons
  • Quizzes


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]