Filter Links
Build links that open a section already sorted or filtered, for menus, sidebars, articles or pages like Events this week.
Ordering Links
Add filter_order and filter_order_Dir (asc or desc) to any section URL.
https://example.com/index.php?option=com_joomcck&view=records§ion_id=1&filter_order=r.title&filter_order_Dir=asc
https://example.com/my-section?filter_order=r.title&filter_order_Dir=asc
| Value | Sorts by |
|---|---|
r.ctime |
Creation date |
r.mtime |
Modification date |
r.extime |
Expiry date |
r.title |
Title |
name |
Author name |
username |
Author username |
r.hits |
Views |
r.comments |
Number of comments |
r.favorite_num |
Number of bookmarks |
r.votes_result |
Rating |
Filter Links
index.php?option=com_joomcck&task=records.filter§ion_id={ID}&Itemid={ID}
| Parameter | Required | Description |
|---|---|---|
section_id |
Yes | Section ID |
Itemid |
Yes | The section's menu item ID |
cat_id |
No | Limit to one category |
filter_name |
Yes | Array of filter names |
filter_val |
Yes | Array of filter values |
clean |
No | 1 clears existing filters first |
After the click the filters are applied and the visitor lands on the normal section URL.
Standard filters
filter_name |
filter_val |
|---|---|
filter_cat |
Category ID |
filter_user |
User ID |
filter_tag |
Tag ID |
filter_type |
Type ID |
filter_search |
Search text |
filter_tpl |
List template name |
Records of user 42 and type 2 (one line in practice):
index.php?option=com_joomcck&task=records.filter§ion_id=2&Itemid=126
&filter_name[0]=filter_type&filter_val[0]=2
&filter_name[1]=filter_user&filter_val[1]=42
Field filters
The filter name is filter_ plus the field key: &filter_name[0]=filter_k2hgsd5FdK79H6Gfdt6hxnsgF55fd. URL-encode the values (%20 for a space).
| Value type | Example |
|---|---|
| One value | &filter_val[0]=value%201 |
| Several values (OR) | &filter_val[0][]=value%201&filter_val[0][]=value%202 |
| Address & Map coordinates | &filter_val[0][lat]=41.254587&filter_val[0][lng]=21.265478 |
| Date range (start, end) | &filter_val[0][range]=2024-09-01,2024-09-30 |
| Boolean | &filter_val[0]=true |
Field key
The key is k plus the MD5 of the field label and type:
$field_key = 'k' . md5($field->label . '-' . $field->field_type); // e.g. md5('Year-digits')
Find it in the key column of #__js_res_fields, or in the key icon tooltip in the administrator fields list.
Reset Links
Reset all filters:
index.php?option=com_joomcck&task=records.cleanall§ion_id=2&Itemid=123
Reset chosen filters (filter_search, filter_type, filter_tag, filter_user, filter_alpha, filter_cat or filter_{key}):
index.php?option=com_joomcck&task=records.clean&clean[filter_type]=1&clean[filter_alpha]=1§ion_id=2&Itemid=123
PHP Helpers
In field output templates you can render filter links with:
FilterHelper::filterLink($name, $value, $text, $type, $tip, $section);
FilterHelper::filterButton($name, $value, $type, $tip, $section, $icon);
$type is the type ID (a type filter is added when the section has several types). filterButton() renders an icon button; $icon is a file in media/com_joomcck/icons/16/ (default funnel-small.png).