Standard Tags
Tag otherwise


The choose, when and otherwise tags allow you to insert content on a page based on conditional statements of user and group membership. The choose tag denotes the start of a secured content section, and the when tags include a test condition that defines who has access to the enclosed content. The otherwise tags includes content that should be displayed as default. The only valid options for the test condition are stringToAclGroup(...).isMember($currentuser) and isGuest($currentuser). The logic.if tag can also be used to create conditional content.

Example:
The syntax is as follows:

<pt:standard.choose>
<pt:standard.when pt:test="stringToACLGroup('user=userid1,userid2,...;group=groupid1,groupid2,groupid3;').isMember($currentuser)">
... content ...
</pt:standard.when>
<pt:standard.otherwise>
... default content ...
</pt:standard.otherwise>
</pt:standard.choose>

The value for the pt:test attribute is case-sensitive. Multiple users or groups should be separated by commas, with semi-colons separating user values from group values.

Example 1:
<pt:standard.choose>
<pt:standard.when pt:test="isGuest($currentuser)">
... guest user content ...
</pt:standard.when>
<pt:standard.otherwise>
... logged in user content ...
</pt:standard.otherwise>
</pt:standard.choose>

The value for the pt:test attribute is case-sensitive. Since there can be multiple guest users in the portal, simply testing for user ID 2 (default guest user) does not work.

Example 2:
<pt:standard.choose>
<pt:standard.when pt:test="stringToACLGroup('user=1;').isMember($currentuser)">
<title>welcome administrator</title></head>
... secret administrator content ...
</pt:standard.when>
<pt:standard.when pt:test="stringToACLGroup('user=200,201;group=200;').isMember($currentuser)">
<title>the 200 club</title></head>
... content only group 200 or users 200 and 201 can see ...
</pt:standard.when>
<pt:standard.otherwise>
<title>everyone else ... content any user can see ...
</pt:standard.otherwise>
</pt:standard.choose>


Tag Information
Tag Nameotherwise
Required Parent Tagchoose

Attributes
No Attributes Defined.


Copyright 2005 Plumtree Software, Inc.