Trang chủ | Email | W2G.,JSC | Liên hệ-Góp ý | SearchWiki:

W2G.,JSC

Quảng cáo

Project

Simulationvn

Tài liệu lập trình

3D Graphics - Đồ họa 3D

Xử lý ảnh

Sách điện tử

sửa SideBar

PmWiki.ConditionalMarkup History

Hide minor edits - Show changes to output

May 23, 2010, at 05:32 AM by gwqjzbuuxf - 2000
Changed lines 1-165 from:
%define=indent block margin-left=2em%
%audience% authors, admins (advanced)
!! Using the [=(:if:)=] Directive
The [@(:if:)@] directive allows portions of a page to be included or
excluded from processing. The generic form of the [@(:if:)@] directive is

%indent% [@(:if cond param:) body (:ifend:)@]

where "cond" names a condition to be tested (described below), and "param"
is a parameter or other argument to the condition.

The built-in conditions include:

(:table border=0 cellpadding=0 cellspacing=0 valign=top:)
(:cellnr rowspan=250:)
%indent% 
(:cell:)[@(:if name PAGENAME:)@]
(:cell:) - 
(:cell:)current page is named "[@PAGENAME@]"
(:cellnr:)[@(:if group GROUPNAME:)@]
(:cell:) - 
(:cell:)current group is named "[@GROUPNAME@]"
(:cellnr:)[@(:if auth LEVEL PAGENAME:)@]
(:cell:) - 
(:cell:)viewer is authorized at "[@LEVEL@]" where [@LEVEL@] can be: [@read@], [@edit@], [@upload@], [@attr@] or [@admin@]; [@PAGENAME@] is optional.
(:cellnr:)[@(:if authid:)@]
(:cell:) - 
(:cell:)current viewer is authenticated
(:cellnr:)[@(:if true:)@]
(:cell:) - 
(:cell:)always include text
(:cellnr:)[@(:if false:)@]
(:cell:) - 
(:cell:)always exclude text (same as a comment)
(:cellnr:)[@(:if attachments:)@]
(:cell:) - 
(:cell:)current page has attachments
(:cellnr:)[@(:if date DATE:)@]
(:cell:) - 
(:cell:)true if current date is [@DATE@]
(:cellnr:)[@(:if date DATE..:)@]
(:cell:) - 
(:cell:)true if current date is [@DATE@] or later (unlimited)
(:cellnr:)[@(:if date DATE1..DATE2:)@]
(:cell:) - 
(:cell:)true if current date is in range [@DATE1@] to [@DATE2@] (inclusive)
(:cellnr colspan=3 align=center:)
%green center%[-''dates are in the format yyyy-mm-dd or yyyymmdd''-]

(:cellnr:)[@(:if enabled VAR:)@]
(:cell:) - 
(:cell:)true if PHP VAR is true
(:cellnr:)[@(:if enabled AuthPw:)@]
(:cell:) - 
(:cell:)true if user has entered any password during the current browser session.
(:cellnr:)[@(:if equal STRING1 STRING2:)@]
(:cell:) - 
(:cell:)true if [@STRING1@] equals [@STRING2@]
(:cellnr:)[@(:if match REG_EXPRESSION:)@]
(:cell:) - 
(:cell:)true if current page name matches the regular expression
(:cellnr:)[@(:if exists PAGENAME:)@]
(:cell:) - 
(:cell:)true if the page ''pagename'' exists
(:tableend:)

Negated forms of conditions also work:

(:table border=0 cellpadding=0 cellspacing=0 valign=top:)
(:cellnr rowspan=250:)
%indent% 
(:cell:)[@(:if !attachments:)@]
(:cell:) - 
(:cell:)this page has no attachments
(:cellnr colspan=3:) 
(:cellnr:)[@(:if ! name PAGENAME:)@]
(:cell rowspan=3:)
(:cell rowspan=3 valign=middle:)current page is NOT named "[@PAGENAME@]"
(:cellnr:)[@(:if name -PAGENAME :)@]
(:cell:)
(:cellnr:)[@(:if name !PAGENAME :)@]
(:tableend:)

Any [@(:if:)@] automatically terminates the previous one, thus markup can be
easily cased (and are not nested):

%indent% [@(:if enabled AuthPw:)* You're logged in@]\\
%indent% [@(:if auth read:)* You can read@]\\
%indent% [@(:if auth edit:)* You can edit@]\\
%indent% [@(:if auth upload:)* You can upload@]\\
%indent% [@(:ifend:)@]

!!! Using wildcard placeholders(:if false:)%green%[-(new for pmwiki 2.1.beta21)-]:(:if:)

The character [@*@] can be used as a wildcard to represent any character,
zero, one or multiple times.\\
The character [@?@] can be used as a wildcard to represent any character
exactly one time.\\
Wildcard characters ([@*@] and [@?@]) can be used with the ''name'' and ''group'' conditional markups, thus:

(:table border=0 cellpadding=0 cellspacing=0 valign=top:)
(:cellnr rowspan=250:)
%indent% 
(:cell:)[@(:if name PmCal.2005* :)@]
(:cell:) - 
(:cell:)current page is in group PmCal and begins with 2005
(:cellnr:)[@(:if group PmWiki* :)@]
(:cell:) - 
(:cell:)current page is in group PmWiki or a group beginning with Pmwiki
(:cellnr:)[@(:if name Profiles.*,-Profiles.Profiles :)@]
(:cell:) - 
(:cell:)current page is in group [@Profiles@] but not [@Profiles.Profiles@]
(:tableend:)

!!! Combining conditions
Conditions (as previously defined) may be combined into more complex
conditional expressions using one of these three equivalent forms:

%indent% [@(:if expr EXPRESSION :)@]\\
%indent% [@(:if [ EXPRESSION ] :)@]\\
%indent% [@(: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:

>>indent<<
|| border=1 cellpadding=2 cellspacing=0
||! Expression ||! Operator ||! Result ||
|| [@A and B@] || And ||TRUE if both A and B are TRUE.||
|| [@A or B@] || Or ||TRUE if either A or B is TRUE.||
|| [@A xor B@] || Xor ||TRUE if either A or B is TRUE, but not both.||
|| [@! A@] || Not ||TRUE if A is not TRUE.||
|| [@A && B@] || And ||TRUE if both A and B are TRUE.||
|| [@A || B@] || Or ||TRUE if either A or B is TRUE.||
>><<

Nota:
* %red% Spaces around operators and brackets are required.
* No specific feedback is given for syntaxic errors or unbalanced brackets.
* Use round brackets (not square) for nested expressions.

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 ] ] :) @]&nbsp;&nbsp;&nbsp;%red%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]]@]
->[@(:if:)@]

which provides you a ''logout'' link ''only'' when authentified with rights higher than 'read'.

%audience% admins (advanced)
!! Creating new conditions

See [[Cookbook:ConditionalMarkupSamples]].

%trail%<<|[[DocumentationIndex]]|>>
to:
Owd4kj <a href="http://wzwjizvybuxc.com/">wzwjizvybuxc</a>, [url=http://dudwdmtiheoo.com/]dudwdmtiheoo[/url], [link=http://anvtylvioijv.com/]anvtylvioijv[/link], http://xidszfajljik.com/

OpenSceneGraph

Tài tiệu Open GL

Tài liệu OSG

Hình ảnh một số sản phẩm

ns7.jpg: 700x439, 303k (December 01, 2011, at 10:13 AM)
osgguide.jpg: 117x160, 21k (December 01, 2011, at 10:13 AM)
srs_02.jpg: 200x150, 60k (December 01, 2011, at 10:13 AM)
ns2.jpg: 700x439, 292k (December 01, 2011, at 10:13 AM)
controlTower5.jpg: 300x250, 29k (December 01, 2011, at 10:13 AM)
vanmieu7_0.jpg: 250x156, 47k (December 01, 2011, at 10:13 AM)

sửa SideBar

Edit - History - Print - Recent Changes - Search
Page last modified on May 23, 2010, at 05:32 AM