Kviečiu išmąstyti ir puoselėti bendrystę ugdytis, bręsti, gyventi amžinai jau čia ir dabar. Pavaizdavimai? E6E6FF Asmeniškai? BA9696 Darbai FFFFC0 Išsiaiškinimai D8F1D8 Užrašai EEEEEE Kitų mintys? ECD9EC Dievas man? FFECC0 Mieli dalyviai! Visa mano kūryba ir kartu visi šie puslapiai yra visuomenės turtas, kuriuo visi kviečiami laisvai naudotis, dalintis, visaip perkurti. - Andrius |
authors, admins (advanced)
Using the (:if:) DirectiveThe (:if cond param:) body (:ifend:)
(:if cond param:) body (:else:) body (:ifend:)
(:if cond param:) body (:elseif cond param:) body (:ifend:)
where "cond" names a condition to be tested, and "param" is a parameter or other argument to the condition. Note that Built-in ConditionsThe built-in conditions include:
The name and group conditionals will work even for an included page, as the "name" and "group" conditionals always check the currently displayed page, as opposed to the page that the markup appears in. Note: Although there is no built-in conditional markup to test ?action=, you can use Negated ConditionsNegated forms of conditions also work:
Nesting ConditionsNote that
Conditions can be nested from 2.2.beta 66. To have nested conditionals you need to number the if, and the matching else/ifend: (:if cond1:) cond1 is true (:if2 cond2:) cond1 and cond2 are true (:else2:) cond1 is true, cond2 is not (:if2end:) (:else:) cond1 is false, cond2 testing was ignored (:ifend:) Spaces were added for better readability. Using wildcard placeholdersThe character
Using page text variables, page variables and markup expressionsPage text variables (PTVs), page variables (PVs) and markup expressions can be used in conditional markup. They will be assigned/evaluated before the condition(s). Combining conditionsConditions (as previously defined) may be combined into more complex conditional expressions using one of these three equivalent forms: (:if expr EXPRESSION :) (:if [ EXPRESSION ] :) (:if ( EXPRESSION ) :) Conditions are combined into expressions with boolean operators and brackets. In the next table, A and B are either regular conditions or (round-)bracketed sub-expressions of regular conditions:
Example (:if [ name SomePage and group SomeGroup ]:) equivalent to (:if name SomeGroup.SomePage:) Important Notes:
Thus, the following is a valid way of building an expression that shows the following contents only when the user is either the administrator, or is logged in and the time is later than the given date: (:if [ auth admin || ( authid && date 2006-06-01.. ) ] :)
Nesting with square brackets will silently fail to work as expected: (:if [ auth admin || [ authid && date 2006-06-01 ] ] :) NOTE: Doesn't Work!
A common use of these complex tests are for expressions like: (:if expr auth admin || auth attr || auth edit :)
[[Logout -> {$Name}?action=logout]]
(:ifend:)
which provides a logout link only when the browser has admin, attr, or edit permissions. admins (advanced) Creating new conditionsSee Cookbook:ConditionalMarkupSamples. See also special references for the use of {*$Variables}. This page may have a more recent version on pmwiki.org: PmWiki:ConditionalMarkup, and a talk page: PmWiki:ConditionalMarkup-Talk. |
ConditionalMarkupNaujausi pakeitimai |
Puslapis paskutinį kartą pakeistas 2010 birželio 10 d., 12:05
|