|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The $$IF$$ directive evaluates the request environment and then conditionally processes (and outputs) content between it and a matching $$ELSE$$ and/or $$ENDIF$$. Conditionals may be nested, and can be used in both the site template and content. Obviously it is intended to allow tailoring of that content. One example might be the inclusion of a coversheet with a printed version. $$IF$!print$$$$HIDE$$ Conditionals expressed in the template apply to the template and those in content apply to the currrent section of content only. There is no global conditional scope. The conditional above when placed on the first line of the section hides it if not printing. $$IF$login$$ There are no fixed layout requirements for conditionals. All on a single line or across multiple lines as applicable is fine. Be aware unexpected white-space may be included in the document (most times to no consequence). EvaluationThe $$IF$$ directive should be provided with a parameter. Without a parameter it evaluates to false.
A parameter can be prefixed by a "!" to logically negate the result; so "!0" is true and "!print" is false when printing. Multiple parameters separated by '$' symbols (as is usual with multiple directive parameters), acting as a logical OR. Hence if any one of mutliple parameters evaluates true then the entire conditional is true. A parameter may be prefixed by ''&&" to make the result a logical AND with any preceding result. No nesting of logical operations is supported. The conditional $$IF$cgi=http_user_agent=Opera$&&print$$ would be true only if printing via the Opera browser, whereas $$IF$cgi=http_user_agent=Opera$cgi=http_user_agent=Mozilla$&&!print$$ would be true if using either Opera or a Mozilla (family) browser and not printing. String EvaluationThe following operators provide more granular tests based on string comparison. All are case-insensitive.
Dynamic ExamplesThe following examples use conditionals to tailor displayed content. What you see will vary on browser in-use and other request characteristics. $$IF$cgi=http_user_agent=MSIE$$ results in something most probably much more standards compliant (non-MSIE) . This is based on a user-agent of "CCBot/2.0". $$IF$login$$ restricts content to those who are currently logged-in. $$IF$lnm=VWCMS_ROOT$$ tells us that your system is currently using the VWCMS_ROOT logical name.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||