Filter tags

From GruppoZenit
Jump to: navigation, search

Z-CMS filter tags are used to apply filters inside Widgets and Content Models.


Contents

zcms:filter

zcms:filter tag contains information about the supplying of data filtering options to a Content Model.

Attribute Definition
attribute Name of the content attribute on which the options will be applied.
value The source of the value. It may be from request, memory, previous content or a constant.
joinwith The conditional operator that is used to join multiple filters.

The possible values are "AND" or "OR" and default is "AND".

operator(deprecated) Defines the operation to be performed. Possible values are:
  1. EQUALS
  2. NOT_EQUALS
  3. GREATERTHAN
  4. GREATERTHAN_EQUAL
  5. LESSTHAN
  6. LESSTHAN_EQUAL
  7. LIKE
operation Defines the operation to be performed. Possible values are:
  1. EQUALS
  2. NOT_EQUALS
  3. GREATERTHAN
  4. GREATERTHAN_EQUAL
  5. LESSTHAN
  6. LESSTHAN_EQUAL
  7. LIKE
  8. IN
  9. IS
  10. ISNOT
plaintext Usually the values to be applied will be wrapped within single quotes (‘). This attribute controls whether or not wrap the single quotes.
pattern The pattern attribute can contain 3 types of values
  1. ALL_WORDS – matches all words with search criteria.
  2. ANY_WORDS – matches any word.
  3. EXACT_PHRASE – shows the data in content model which has exact match with the search parameter.
clause Optional.

The value of the attribute can be "true" or false. if "true",the attribute will remove the default operator '=' and allows the user to add the clauses like IS NULL , IS NOT NULL in the condition. By default the value is "false".

Example on how to use the filter tag:

<zcms:filter attribute="publish" value="1" plaintext="true"/>	
<zcms:filter attribute="email" value="$request[search]" joinwith="and" pattern="ALL_WORDS" operation="LIKE" />


Example on how to use the filter tag with clause:

<zcms:filter attribute="title" value="is not null" plaintext="true" clause="true"/>

The above example will create the condition in query "title is not null"

zcms:global-filters

zcms:global-filters tag is used to apply filters for global contents inside a Widget. The filters will be applied to the Content Model with name specified as the attribute "name" of the tag.

Attribute Definition
name Name of content model to which the filter is applied.

An example for using this tag can be the following:

<zcms:include widget="sample" type="test" class="testclasss">
   <zcms:global-filters name="mycontent">
      <zcms:filter attribute="publish" value="1" plaintext="true"/>
      <zcms:filter attribute="fk_menu_id" value="IS NULL" plaintext="true" clause="true"/>
   </zcms:global-filters>
</zcms:include>


zcms:filters

zcms:filters tag is used to apply filters for Site specific Content Models inside a Widget. The filters will be applied to the Content Model with name specified as the attribute "name" of the tag.

Attribute Definition
name Name of content model to which the filter is applied.

An example for using this tag can be the following:

<zcms:include widget="sample" type="test" class="testclasss">
   <zcms:filters name="mycontent">
      <zcms:filter attribute="publish" value="1" plaintext="true"/>
      <zcms:filter attribute="fk_menu_id" value="IS NULL" plaintext="true" clause="true"/>
   </zcms:filters>
</zcms:include>

zcms:filter-group

zcms:filter-group tag is used to group the filter, the filter group can be joined with another filter or filter-group using the condition ‘AND’ or ‘OR’.

Attribute Definition
joinwith The conditional operator that is used to join filters-group.

The possible values are AND or OR and default is "AND".

An example for using this tag can be the following:

<zcms:content id="categoryId" name="category">
     <zcms:filter attribute="name" value="abcd"/>
     <zcms:filter-group joinwith="and">
         <zcms:filter attribute="status" value="1" joinwith="or"/>
         <zcms:filter attribute="status_internal" value="5" joinwith="or" />
     </zcms:filter-group>
  </zcms:content>

See also

Personal tools
Namespaces

Variants
Actions
Toolbox