[ShowIf Comparison]Show This HTML[/ShowIf]

Displays HTML conditionally only if the comparison is true.

To display some HTML (or [xxx] tags) only if certain conditions are met, put the text inside a [ShowIf] container. The comparison, which may contain any [xxx] tags, is first evaluated to see if it is true, and if true then the contained text is displayed. If not true, then any text or [xxx] tags inside the container will be ignored. See [HideIf].

Note: ShowIf 'does the right thing' when it hides its container: any contexts inside the [ShowIf] container (e.g. [Append] or [Replace] or [Delete]) will not be executed if ShowIf evaluates to false.

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):

[ShowIf [username]=Grant]You're allowed in![/ShowIf]

Try It!

Comparisons are always case-insensitive so "grant" equals "GRANT".

Comparison Example



[ShowIf [username]=SAGEHEN]Welcome Mr. Sagehen[/ShowIf]

not equal


[ShowIf [random]!45]...[/ShowIf]



[ShowIf [browsername]^Mozilla]

begins with


[ShowIf [ipaddress]^245.078.013]...[/ShowIf].

Notice the IP address has been typed with 3 digits in each portion of the address. This is very important for making these comparison work as expected.

less than


[ShowIf [random]<50]...[/ShowIf]

greater than


[ShowIf [lastrandom]>25]...[/ShowIf]

divisible by


[ShowIf [index]\3]...[/ShowIf]

Note: if both side of the equation are numbers, then the comparison for greater than, less than, and equals is performed numerically. If either side is not a number, then the comparison is performed alphabetically.
Tip: make sure neither side of the comparison equation contains any of the special comparison letters listed above. For example, [ShowIf I'm Friendly! Are you?=[question]] contains an exclamation point inside the sentence being compared, so WebCatalog sees this as "I'm Friendly" is not equal to " Are you?=[question]", which is not what the author meant to compare.

The solution is to wrap each side of the comparison with [URL] contexts, like this:
[ShowIf [URL]I'm Friendly! Are you?[/URL]=[URL][question][/URL]]. This causes any embedded !=>< symbols to be converted to their URL equivalents, which can then be compared correctly.