version=pmwiki-2.1.beta22 ordered=1 urlencoded=1 agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 author=TeganDowling host=207.250.88.6 name=PmWiki.ConditionalMarkup rev=66 targets=PmWiki.DocumentationIndex text=%25audience%25 authors, admins (advanced)%0a!! Using the [=(:if:)=] Directive%0aThe [@(:if:)@] directive allows portions of a page to be included or excluded from processing. The generic form of the [@(:if:)@] directive is%0a%0a [@(:if cond param:) body (:ifend:)@]%0a%0awhere "cond" names a condition to be tested (described below), and "param" is a parameter or other argument to the condition.%0a%0aThe built-in conditions include:%0a%0a[@%0a (:if name PAGENAME:) - current page is named "PAGENAME"%0a (:if group GROUPNAME:) - current group is named "GROUPNAME"%0a (:if auth LEVEL:) - viewer is authorized at "LEVEL"%0a where LEVEL can be : read, edit,%0a upload, attr or admin %0a (:if authid:) - current viewer is authenticated%0a (:if true:) - always include text%0a (:if false:) - always exclude text (same as a comment)%0a (:if attachments:) - current page has attachments%0a (:if date DATE:) - true if current date is DATE%0a (:if date DATE..:) - true if current date is DATE or later (unlimited) %0a (:if date DATE1..DATE2:) - true if current date is in range DATE1 to DATE2 (inclusive)%0a (dates are in the format yyyy-mm-dd or yyyymmdd)%0a (:if enabled VAR:) - true if PHP VAR is true%0a (:if equal STRING1 STRING2:) - true if STRING1 equals STRING2%0a (:if match REG_EXPRESSION:) - true if current page name matches %0a the regular expression%0a@]%0a %0aNegated forms of conditions also work%0a%0a [@(:if !attachments:) This page has no attachments@]%0a %0a [@(:if ! name PAGENAME:)@] - current page is NOT named "PAGENAME"%0a [@(:if name -PAGENAME :)@] - current page is NOT named "PAGENAME"%0a [@(:if name !PAGENAME :)@] - current page is NOT named "PAGENAME"%0a%0aAny [@(:if:)@] automatically terminates the previous one, thus markup can be easily cased (and are not nested):%0a%0a [@(:if auth read:)* You can read%0a (:if auth edit:)* You can edit%0a (:if auth upload:)* You can upload%0a (:ifend:)@]%0a%0a!!!Using wildcard placeholders %25green%25[-(new for pmwiki 2.1.beta21)-]:%0aThe character * can be used as a wildcard to represent any character, zero, one or multiple times.\\%0aThe character ? can be used as a wildcard to represent any character exactly one time.\\%0aWildcard characters (* and ?) can be used in conditional markup, thus:%0a%0a [@(:if name PmCal.2005* :)@] - current page is in group PmCal and begins with 2005%0a [@(:if group PmWiki* :)@] - current page is in group PmWiki or a group beginning with Pmwiki %0a [@(:if name Profiles.*,-Profiles.Profiles :)@] - current page is in group Profiles but not Profiles.Profiles%0a%0a%25audience%25 admins (advanced)%0a!! Creating new conditions%0a%0aSee [[Cookbook:ConditionalMarkupSamples]].%0a%0a%25trail%25%3c%3c|[[DocumentationIndex]]|>>%0a time=1138646465