The mgiInlineIf Tag

Tag Behavior

The mgiInlineIf tag performs a conditional comparison and displays a result based upon the outcome of the comparison. When the mgiInlineIf tag is parsed, both the "true" and "false" values are simultaneously calculated, but only the appropriate value is actually displayed.

Note: Due to customer requests, the mgiConditional tag was created as a complete if, then, else comparison solution. The mgiConditional and mgiIf tags perform the same function, but the mgiConditional tag has a simpler, more complete structure. We recommend that you use the mgiConditional tag rather than the mgiIf or mgiInlineIf tags.


Tag Syntax

The mgiInlineIf tag has two required parameters for all targets and one optional parameter for all targets. In addition, the mgiInlineIf tag has required and optional parameters for specific targets. The tag form is:

<mgiInlineIf target="Target" then="True" else="False">

Required Parameters for all Targets:

  • target="Target" where "Target" is the object of the conditional comparison. Valid targets include the following. See the specific required and optional parameters for each target type below.
    • "Browser" - the Browser target is a comparison with the browser string in the HTTP request (1 required, 1 optional parameter).
    • "Client" - the Client target is a comparison with the client IP number or domain name in the HTTP request (1 required parameter).
    • "Cookie" - the Cookie target is a comparison with the value of a specified cookie (1 required, 1 optional parameter).
    • "Date" - the Date target is a comparison with current GMT weekday, month, day, or year (4 optional parameters).
    • "Field" - the Field target is a comparison with the value of a posted form field submission (2 required, 1 optional parameters).
    • "PostArgument" - the PostArgument target is a comparison with the value of a posted form field submission (2 required, 1 optional parameters).
    • "Referrer" - the Referrer target is a comparison with the complete or partial referral URL (1 required, 1 optional parameter).
    • "Variable" - the Variable target is a comparison with the value of a specified variable (2 required, 1 optional parameters).
  • then="True" where "True" is the text displayed if the conditional comparison is true. HTML code is not allowed in the value of this parameter.

Optional Parameter for all Targets:

  • else="False" where "False" is the text displayed if the conditional comparison is false. HTML code is not allowed in the value of this parameter.

Browser Target Parameters:

Required

  • contains="String" where "String" is any portion of the comparison browser HTTP request (e.g. "Mozilla" for Netscape browsers, "IE" for Internet Explorer browsers, "3.0" for version 3 browsers, etc.).

Optional

  • case-sensitive="Yes" or "No" where "Yes" indicates that the comparison string must match the case of the HTTP browser and "No" indicates that the comparison string is not required to match the case of the HTTP browser. The default is "No".

Client Target Parameters:

Required

  • value="IPorDN" where "IPorDN" is the comparison IP address or client domain address. Wildcard comparisons can be achieved with an asterisk (*). For example, *.domainA.com will match all clients from domainA.com and 205.152.*.* will match all clients from the 205.152 LAN. (Note: to complete a domain comparison, domain lookups must be enabled on the server.)

Cookie Target Parameters:

Required

  • name="Name" where "Name" is the name of the comparison cookie.
  • value="Value" where "Value" is the value to compare with the value of the cookie.

Optional

  • relationship="Comparison Type" where "Comparison Type" is the type of comparison to perform between the cookie value and the value parameter. Comparison Types include "equalTo", "notEqualTo", "contains", "beginsWith" and "endsWith". The default relationship is "equalTo". All comparison types are case-sensitive.

Date Target Parameters:

Optional

  • weekday="Day" where "Day" is the full or abbreviated text week day comparison (e.g. "Tuesday" or "Tues").
  • month="Month" where "Month" is the full text, abbreviated text, numeric month or padded numeric month comparison (e.g. "March", "Mar", "3", or "03").
  • day="Integer" where "Integer" is the numeric day of the month or padded numeric day of the month comparison (e.g. "9" or "09").
  • year="Integer" where "Integer" is the four-digit or two-digit year comparison (e.g. "1999" or "99").

Field Target and Post Argument Target Parameters:

Required

  • name="Name" where "Name" is the name of the comparison form field or posted argument.
  • value="Value" where "Value" is the value to compare with the value of the form field or posted argument. For the relationship "isEmpty", the value parameter is not required.

Optional

  • relationship="Comparison Type" where "Comparison Type" is the type of comparison to perform between the form field/post argument value and the value parameter. Comparison Types include "equalTo", "notEqualTo", "contains", "beginsWith", "endsWith", "isEmpty", "lessThan", "greaterThan", "lessThanOrEqualTo" and "greaterThanOrEqualTo". The default relationship is "equalTo". All comparison types are case-sensitive. The four less than and greater than comparison types function only if the value of the form field or post argument is a number. If the value is not a number, then "False" will be displayed.

Referrer Target Parameters:

Required

  • value="String" where "String" is any portion of the comparison referral URL.

Optional

  • match="Exact" or "Partial" where "Exact" performs an exact comparison with the referral URL and "Partial" will match any portion of the referral URL. The default match is "Exact".

Variable Target Parameters:

Required

  • name="Name" where "Name" is the name of the comparison variable.
  • value="Value" where "Value" is the value to compare with the value of the variable. For the relationship "isEmpty", the value parameter is not required.

Optional

  • relationship="Comparison Type" where "Comparison Type" is the type of comparison to perform between the form variable value and the value parameter. Comparison Types include "equalTo", "notEqualTo", "contains", "beginsWith", "endsWith", "isEmpty", "lessThan", "greaterThan", "lessThanOrEqualTo" and "greaterThanOrEqualTo". The default relationship is "equalTo". All comparison types are case-sensitive. The four less than and greater than comparison types function only with page variables or site variables that are a "Number" type. The tag auto-detects the type of variable.
  • scope="Page" or "Site" where "Page" indicates that the variable was set as a temporary page variable and where "Site" indicates that the variable was set as a permanent site variable. The default scope is "Page".


Example Usage and Output

<mgiInlineIf target="Date" weekday="Friday" 
then="Welcome to the Weekend!">

If the current GMT weekday was Friday, the mgiInlineIf tag in this example would display:

Welcome to the Weekend!

If the current GMT weekday was Saturday through Thursday, the mgiInlineIf tag in this example would display nothing.

<mgiInlineIf target="Cookie" name="Subscription" value="June 1999" 
relationship="contains" then="Renew your subscription today!" 
else="Thank you for your support.">

In this example, customers whose subscriptions are near expiration will see:

Renew your subscription today!

Other customers will see:

Thank you for your support.


Suggested Usage

  • Conditional Comparisons


[Return to the Referencing MGI Menu]


[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]