Ordering contents

From GruppoZenit
Jump to: navigation, search

Z-CMS provides the option for filtering and ordering content data stored inside attributes of Content Models. Below tags used for filtering and ordering data are described in detail.



Filtering can be applied by appropriately using the following Z-CMS filter tags:

The Z-CMS filter tag zcms:global-filters is to be used with General Widgets. For site specific Widgets the tag zcms:filters should be used.

Both these tags are actually filter-container tags, meaning that they enable option for applying more than one filter condition simultaneously.

However, if there is only one filter condition to be applied, it can be directly realized using the zcms:filter. Filter attribute and the filter value are specified inside the zcms:filter tag.

Example: filter usage in the General perspective

Below an example of a filter applied for double filter conditions in the General part:

   <zcms:filter attribute="publish" value="1" plaintext="true"/>
   <zcms:filter attribute="menu_id" value="IS NULL" plaintext="true" clause="true"/>


Ordering of attribute content data can be achieved in Z-CMS using the following Z-CMS tag: zcms:dataorder. An example of order usage is given below:

<zcms:dataorder attribute="sort_order" order="asc" />

Example: sorting in ascending order a category

Consider the following case that applies a "category" filter on "products" and then sorts the "products" based on their respective "sort_order" value in the ascending order:

<div class="cls_contmenu">             
   <table width="100%" border="1" cellspacing="0" cellpadding="0">                           
         <td class="cls_bgblue" height="90" align="center">
            <h1 class="cls_menutitle">
               <zcms:content name="Products_CM" > 
               <zcms:filter attribute="category_id" value="$request[$2]"/>
               <zcms:attribute name="name"/>
               <zcms:dataorder attribute="sort_order" order="asc" />

In this example, filter value for the filter attribute "category_id" is obtained from the page request.

See also

Personal tools