Logic Tags
Tag containsexpr


This tag checks if an collection contains a specific data element and sets a specified variable to true or false. It is designed to work with the logic.if tag.

Example:
<pt:ptdata.mycommunitiesdata pt:id="comms"/>
<pt:logic.foreach pt:data="comms" pt:var="curr">
 <pt:logic.containsexpr pt:expr="($curr) contains currpage" pt:key="boolvalue"/>

<pt:logic.if pt:expr="$boolvalue">
 <pt:logic.iftrue>
  This is displayed if expr evaluates to true.
 </pt:logic.iftrue>
 <pt:logic.iffalse>
   This is displayed if expr evaluates to false.
 </pt:logic.iffalse>
</pt:logic.if>


</pt:logic.foreach>


or ...

<pt:logic.data pt:key="data" name="abc"/>
<pt:logic.containsexpr pt:expr="($data) contains name" pt:key="boolvalue" />

<pt:logic.if pt:expr="$boolvalue">
 <pt:logic.iftrue>
  This is displayed if expr evaluates to true.
 </pt:logic.iftrue>
 <pt:logic.iffalse>
   This is displayed if expr evaluates to false.
 </pt:logic.iffalse>
</pt:logic.if>


Tag Information
Tag Namecontainsexpr

Attributes
NameTypeRequiredDefault ValueDescription
keystringtruenullThe key used to store the result in memory.
scopestringfalseportlet requestThe scope used to store the result in memory. See the Logic tag library description for details about valid scope arguments.
exprstringtruenullA string expression that requires three components separated by a space: 1. A variable reference for a data object in parentheses (entry in a pt:data list, or a variable created from the logic.data tag) 2. The word "contains" 3. The key of an element in the data to check for. Example: expr="($mydata) contains myelement"


Copyright 2005 Plumtree Software, Inc.