Joomlatools Pages also allows to filter

Preliminary note: difference between Searching and Filtering:

  • when you search you start with nothing and you go find something
  • when you filter you start with everything and you remove items that don't follow the constraints you provide

Filtering via url

Click on the following links and see the list of articles changing in function of the filter criteria.


List of (filtered) articles:

  • Organization 1 (id: 2)
  • Organization 2 (id: 3)
  • Organization 3 (id: 4)
  • This website is a step by step demo of what you can do with Joomlatools Pages (id: 1)

Filtering can be done via the Frontmatter, the url or the code

Note: it works great for data coming from webservices, or from arrays, for database this is a tad harder to implement, it works for data from the same table, for related data it's harder. Still working on making it so that you don't need special states for filtering on db.

Filters work on

  • ID
  • category
  • access (=> use userid)
  • editor (=> use userid)
  • author (=> user userid)

For more information, see https://github.com/joomlatools/joomlatools-pages/pull/363

Filters also work with States: you can use the collection stats both in your frontmatter and in your url too.
States are easy to find: https://github.com/joomlatools/joomlatools-pages/blob/master/contrib/extensions/joomla/model/articles.php#L16

Note: 'filter' is an approach to try and make this just work, without needing much custom code. This works great for example for a database table if you use the base database collection or for a webservice, but in case of the joomla extension we are not talking one to one to the daabase table, so filter doesn'y work there that easily.


For more information about Filtering see also


And here is a little var_dump(collection()) so that you can see all what is immediately available in the array itself:

object(ComPagesModelEntityItems)#1847 (4) {
  [2]=>
  array(25) {
    ["id"]=>
    string(1) "2"
    ["slug"]=>
    string(14) "organization-1"
    ["title"]=>
    string(14) "Organization 1"
    ["summary"]=>
    string(0) ""
    ["category"]=>
    string(753) "object(ExtJoomlaModelEntityCategory)#2071 (16) {
  ["id"]=>
  string(1) "8"
  ["slug"]=>
  string(13) "organizations"
  ["title"]=>
  string(13) "Organizations"
  ["summary"]=>
  string(0) ""
  ["date"]=>
  string(25) "2021-04-22T08:35:56+00:00"
  ["edited_date"]=>
  string(25) "2021-04-22T08:35:56+00:00"
  ["author"]=>
  string(3) "844"
  ["editor"]=>
  string(3) "844"
  ["impressions"]=>
  int(0)
  ["direction"]=>
  string(4) "auto"
  ["language"]=>
  string(1) "*"
  ["parent"]=>
  NULL
  ["published"]=>
  string(1) "1"
  ["image"]=>
  array(0) {
  }
  ["name"]=>
  string(13) "Organizations"
  ["metadata"]=>
  array(4) {
    ["og:title"]=>
    NULL
    ["og:url"]=>
    NULL
    ["og:image"]=>
    NULL
    ["og:description"]=>
    NULL
  }
}
"
    ["tags"]=>
    array(0) {
    }
    ["date"]=>
    string(25) "2021-04-20T08:38:13+00:00"
    ["edited_date"]=>
    string(25) "2021-04-24T12:46:12+00:00"
    ["published_date"]=>
    string(25) "2021-04-20T08:38:13+00:00"
    ["archived_date"]=>
    NULL
    ["author"]=>
    string(3) "844"
    ["editor"]=>
    string(3) "844"
    ["image"]=>
    array(3) {
      ["url"]=>
      string(25) "/images/headers/maple.jpg"
      ["alt"]=>
      string(5) "maple"
      ["caption"]=>
      string(5) "maple"
    }
    ["impressions"]=>
    int(0)
    ["direction"]=>
    string(4) "auto"
    ["language"]=>
    string(1) "*"
    ["published"]=>
    string(1) "1"
    ["archived"]=>
    string(1) "0"
    ["trashed"]=>
    string(1) "0"
    ["featured"]=>
    string(1) "0"
    ["links"]=>
    array(0) {
    }
    ["ordering"]=>
    int(1)
    ["metadata"]=>
    array(10) {
      ["og:type"]=>
      string(7) "article"
      ["og:title"]=>
      string(14) "Organization 1"
      ["og:url"]=>
      NULL
      ["og:image"]=>
      string(25) "/images/headers/maple.jpg"
      ["og:description"]=>
      NULL
      ["article:published_time"]=>
      string(25) "2021-04-20T08:38:13+00:00"
      ["article:modified_time"]=>
      string(25) "2021-04-24T12:46:12+00:00"
      ["article:expiration_time"]=>
      NULL
      ["article:tag"]=>
      array(0) {
      }
      ["og:locale"]=>
      string(1) "*"
    }
    ["fields"]=>
    string(1407) "object(ExtJoomlaModelEntityFields)#2507 (2) {
  ["socialbrusselsid"]=>
  array(14) {
    ["id"]=>
    string(1) "1"
    ["name"]=>
    string(16) "socialbrusselsid"
    ["title"]=>
    string(18) "social.brussels ID"
    ["type"]=>
    string(4) "text"
    ["label"]=>
    string(18) "social.brussels ID"
    ["default"]=>
    string(0) ""
    ["published"]=>
    string(1) "1"
    ["required"]=>
    string(1) "0"
    ["params"]=>
    array(2) {
      ["filter"]=>
      string(0) ""
      ["maxlength"]=>
      string(0) ""
    }
    ["group"]=>
    NULL
    ["language"]=>
    string(1) "*"
    ["multi"]=>
    string(1) "0"
    ["ordering"]=>
    int(1)
    ["value"]=>
    string(5) "13817"
  }
  ["youtube"]=>
  array(14) {
    ["id"]=>
    string(1) "2"
    ["name"]=>
    string(7) "youtube"
    ["title"]=>
    string(11) "YouTube URL"
    ["type"]=>
    string(3) "url"
    ["label"]=>
    string(11) "YouTube URL"
    ["default"]=>
    string(0) ""
    ["published"]=>
    string(1) "1"
    ["required"]=>
    string(1) "0"
    ["params"]=>
    array(2) {
      ["schemes"]=>
      array(1) {
        [0]=>
        string(5) "https"
      }
      ["relative"]=>
      string(0) ""
    }
    ["group"]=>
    NULL
    ["language"]=>
    string(1) "*"
    ["multi"]=>
    string(1) "0"
    ["ordering"]=>
    int(2)
    ["value"]=>
    string(43) "https://www.youtube.com/watch?v=LXeaDPmHP18"
  }
}
"
    ["name"]=>
    string(14) "Organization 1"
  }
  [3]=>
  array(25) {
    ["id"]=>
    string(1) "3"
    ["slug"]=>
    string(14) "organization-2"
    ["title"]=>
    string(14) "Organization 2"
    ["summary"]=>
    string(0) ""
    ["category"]=>
    string(753) "object(ExtJoomlaModelEntityCategory)#2178 (16) {
  ["id"]=>
  string(1) "8"
  ["slug"]=>
  string(13) "organizations"
  ["title"]=>
  string(13) "Organizations"
  ["summary"]=>
  string(0) ""
  ["date"]=>
  string(25) "2021-04-22T08:35:56+00:00"
  ["edited_date"]=>
  string(25) "2021-04-22T08:35:56+00:00"
  ["author"]=>
  string(3) "844"
  ["editor"]=>
  string(3) "844"
  ["impressions"]=>
  int(0)
  ["direction"]=>
  string(4) "auto"
  ["language"]=>
  string(1) "*"
  ["parent"]=>
  NULL
  ["published"]=>
  string(1) "1"
  ["image"]=>
  array(0) {
  }
  ["name"]=>
  string(13) "Organizations"
  ["metadata"]=>
  array(4) {
    ["og:title"]=>
    NULL
    ["og:url"]=>
    NULL
    ["og:image"]=>
    NULL
    ["og:description"]=>
    NULL
  }
}
"
    ["tags"]=>
    array(0) {
    }
    ["date"]=>
    string(25) "2021-04-21T08:38:13+00:00"
    ["edited_date"]=>
    string(25) "2021-04-24T12:46:22+00:00"
    ["published_date"]=>
    string(25) "2021-04-21T08:38:13+00:00"
    ["archived_date"]=>
    NULL
    ["author"]=>
    string(3) "844"
    ["editor"]=>
    string(3) "844"
    ["image"]=>
    array(3) {
      ["url"]=>
      string(29) "/images/headers/raindrops.jpg"
      ["alt"]=>
      string(9) "raindrops"
      ["caption"]=>
      string(9) "raindrops"
    }
    ["impressions"]=>
    int(0)
    ["direction"]=>
    string(4) "auto"
    ["language"]=>
    string(1) "*"
    ["published"]=>
    string(1) "1"
    ["archived"]=>
    string(1) "0"
    ["trashed"]=>
    string(1) "0"
    ["featured"]=>
    string(1) "0"
    ["links"]=>
    array(0) {
    }
    ["ordering"]=>
    int(2)
    ["metadata"]=>
    array(10) {
      ["og:type"]=>
      string(7) "article"
      ["og:title"]=>
      string(14) "Organization 2"
      ["og:url"]=>
      NULL
      ["og:image"]=>
      string(29) "/images/headers/raindrops.jpg"
      ["og:description"]=>
      NULL
      ["article:published_time"]=>
      string(25) "2021-04-21T08:38:13+00:00"
      ["article:modified_time"]=>
      string(25) "2021-04-24T12:46:22+00:00"
      ["article:expiration_time"]=>
      NULL
      ["article:tag"]=>
      array(0) {
      }
      ["og:locale"]=>
      string(1) "*"
    }
    ["fields"]=>
    string(1406) "object(ExtJoomlaModelEntityFields)#2642 (2) {
  ["socialbrusselsid"]=>
  array(14) {
    ["id"]=>
    string(1) "1"
    ["name"]=>
    string(16) "socialbrusselsid"
    ["title"]=>
    string(18) "social.brussels ID"
    ["type"]=>
    string(4) "text"
    ["label"]=>
    string(18) "social.brussels ID"
    ["default"]=>
    string(0) ""
    ["published"]=>
    string(1) "1"
    ["required"]=>
    string(1) "0"
    ["params"]=>
    array(2) {
      ["filter"]=>
      string(0) ""
      ["maxlength"]=>
      string(0) ""
    }
    ["group"]=>
    NULL
    ["language"]=>
    string(1) "*"
    ["multi"]=>
    string(1) "0"
    ["ordering"]=>
    int(1)
    ["value"]=>
    string(4) "3322"
  }
  ["youtube"]=>
  array(14) {
    ["id"]=>
    string(1) "2"
    ["name"]=>
    string(7) "youtube"
    ["title"]=>
    string(11) "YouTube URL"
    ["type"]=>
    string(3) "url"
    ["label"]=>
    string(11) "YouTube URL"
    ["default"]=>
    string(0) ""
    ["published"]=>
    string(1) "1"
    ["required"]=>
    string(1) "0"
    ["params"]=>
    array(2) {
      ["schemes"]=>
      array(1) {
        [0]=>
        string(5) "https"
      }
      ["relative"]=>
      string(0) ""
    }
    ["group"]=>
    NULL
    ["language"]=>
    string(1) "*"
    ["multi"]=>
    string(1) "0"
    ["ordering"]=>
    int(2)
    ["value"]=>
    string(43) "https://www.youtube.com/watch?v=Gooof6e6BvQ"
  }
}
"
    ["name"]=>
    string(14) "Organization 2"
  }
  [4]=>
  array(25) {
    ["id"]=>
    string(1) "4"
    ["slug"]=>
    string(14) "organization-3"
    ["title"]=>
    string(14) "Organization 3"
    ["summary"]=>
    string(0) ""
    ["category"]=>
    string(753) "object(ExtJoomlaModelEntityCategory)#2285 (16) {
  ["id"]=>
  string(1) "8"
  ["slug"]=>
  string(13) "organizations"
  ["title"]=>
  string(13) "Organizations"
  ["summary"]=>
  string(0) ""
  ["date"]=>
  string(25) "2021-04-22T08:35:56+00:00"
  ["edited_date"]=>
  string(25) "2021-04-22T08:35:56+00:00"
  ["author"]=>
  string(3) "844"
  ["editor"]=>
  string(3) "844"
  ["impressions"]=>
  int(0)
  ["direction"]=>
  string(4) "auto"
  ["language"]=>
  string(1) "*"
  ["parent"]=>
  NULL
  ["published"]=>
  string(1) "1"
  ["image"]=>
  array(0) {
  }
  ["name"]=>
  string(13) "Organizations"
  ["metadata"]=>
  array(4) {
    ["og:title"]=>
    NULL
    ["og:url"]=>
    NULL
    ["og:image"]=>
    NULL
    ["og:description"]=>
    NULL
  }
}
"
    ["tags"]=>
    array(0) {
    }
    ["date"]=>
    string(25) "2021-04-22T08:38:13+00:00"
    ["edited_date"]=>
    string(25) "2021-05-05T14:26:26+00:00"
    ["published_date"]=>
    string(25) "2021-04-22T08:38:13+00:00"
    ["archived_date"]=>
    NULL
    ["author"]=>
    string(3) "844"
    ["editor"]=>
    string(3) "844"
    ["image"]=>
    array(3) {
      ["url"]=>
      string(31) "/images/headers/walden-pond.jpg"
      ["alt"]=>
      string(11) "walden pond"
      ["caption"]=>
      string(11) "walden pond"
    }
    ["impressions"]=>
    int(0)
    ["direction"]=>
    string(4) "auto"
    ["language"]=>
    string(1) "*"
    ["published"]=>
    string(1) "1"
    ["archived"]=>
    string(1) "0"
    ["trashed"]=>
    string(1) "0"
    ["featured"]=>
    string(1) "0"
    ["links"]=>
    array(0) {
    }
    ["ordering"]=>
    int(3)
    ["metadata"]=>
    array(10) {
      ["og:type"]=>
      string(7) "article"
      ["og:title"]=>
      string(14) "Organization 3"
      ["og:url"]=>
      NULL
      ["og:image"]=>
      string(31) "/images/headers/walden-pond.jpg"
      ["og:description"]=>
      NULL
      ["article:published_time"]=>
      string(25) "2021-04-22T08:38:13+00:00"
      ["article:modified_time"]=>
      string(25) "2021-05-05T14:26:26+00:00"
      ["article:expiration_time"]=>
      NULL
      ["article:tag"]=>
      array(0) {
      }
      ["og:locale"]=>
      string(1) "*"
    }
    ["fields"]=>
    string(5776) "object(ExtJoomlaModelEntityFields)#2701 (5) {
  ["socialbrusselsid"]=>
  array(14) {
    ["id"]=>
    string(1) "1"
    ["name"]=>
    string(16) "socialbrusselsid"
    ["title"]=>
    string(18) "social.brussels ID"
    ["type"]=>
    string(4) "text"
    ["label"]=>
    string(18) "social.brussels ID"
    ["default"]=>
    string(0) ""
    ["published"]=>
    string(1) "1"
    ["required"]=>
    string(1) "0"
    ["params"]=>
    array(2) {
      ["filter"]=>
      string(0) ""
      ["maxlength"]=>
      string(0) ""
    }
    ["group"]=>
    NULL
    ["language"]=>
    string(1) "*"
    ["multi"]=>
    string(1) "0"
    ["ordering"]=>
    int(1)
    ["value"]=>
    string(3) "470"
  }
  ["youtube"]=>
  array(14) {
    ["id"]=>
    string(1) "2"
    ["name"]=>
    string(7) "youtube"
    ["title"]=>
    string(11) "YouTube URL"
    ["type"]=>
    string(3) "url"
    ["label"]=>
    string(11) "YouTube URL"
    ["default"]=>
    string(0) ""
    ["published"]=>
    string(1) "1"
    ["required"]=>
    string(1) "0"
    ["params"]=>
    array(2) {
      ["schemes"]=>
      array(1) {
        [0]=>
        string(5) "https"
      }
      ["relative"]=>
      string(0) ""
    }
    ["group"]=>
    NULL
    ["language"]=>
    string(1) "*"
    ["multi"]=>
    string(1) "0"
    ["ordering"]=>
    int(2)
    ["value"]=>
    string(43) "https://www.youtube.com/watch?v=g21IiNrkhXA"
  }
  ["internallink"]=>
  array(14) {
    ["id"]=>
    string(1) "3"
    ["name"]=>
    string(12) "internallink"
    ["title"]=>
    string(13) "Internal link"
    ["type"]=>
    string(8) "articles"
    ["label"]=>
    string(13) "Internal link"
    ["default"]=>
    string(0) ""
    ["published"]=>
    string(1) "1"
    ["required"]=>
    string(1) "0"
    ["params"]=>
    array(17) {
      ["field_type"]=>
      string(8) "articles"
      ["multiple"]=>
      string(1) "1"
      ["filter_categories"]=>
      string(1) "0"
      ["categories_inc_children"]=>
      string(1) "0"
      ["articles_ordering"]=>
      string(5) "title"
      ["articles_ordering_direction"]=>
      string(3) "ASC"
      ["articles_ordering_2"]=>
      string(7) "created"
      ["articles_ordering_direction_2"]=>
      string(4) "DESC"
      ["layout"]=>
      string(5) "title"
      ["custom_field"]=>
      string(0) ""
      ["link_title"]=>
      string(1) "0"
      ["custom_html"]=>
      string(36) "[title] ([hits])"
      ["use_separator"]=>
      string(1) "1"
      ["separator"]=>
      string(2) ", "
      ["show_unpublished"]=>
      string(1) "0"
      ["show_category"]=>
      string(1) "0"
      ["articles_grouping"]=>
      string(5) "title"
    }
    ["group"]=>
    NULL
    ["language"]=>
    string(1) "*"
    ["multi"]=>
    string(1) "1"
    ["ordering"]=>
    int(3)
    ["value"]=>
    array(3) {
      [0]=>
      string(1) "6"
      [1]=>
      string(1) "2"
      [2]=>
      string(1) "1"
    }
  }
  ["repeatable"]=>
  array(14) {
    ["id"]=>
    string(1) "4"
    ["name"]=>
    string(10) "repeatable"
    ["title"]=>
    string(10) "Repeatable"
    ["type"]=>
    string(10) "repeatable"
    ["label"]=>
    string(10) "Repeatable"
    ["default"]=>
    string(0) ""
    ["published"]=>
    string(1) "1"
    ["required"]=>
    string(1) "0"
    ["params"]=>
    array(1) {
      ["fields"]=>
      array(1) {
        ["fields0"]=>
        array(3) {
          ["fieldname"]=>
          string(4) "DATE"
          ["fieldtype"]=>
          string(8) "calendar"
          ["fieldfilter"]=>
          string(1) "1"
        }
      }
    }
    ["group"]=>
    NULL
    ["language"]=>
    string(1) "*"
    ["multi"]=>
    string(1) "0"
    ["ordering"]=>
    int(4)
    ["value"]=>
    array(2) {
      [0]=>
      array(1) {
        ["DATE"]=>
        string(10) "2021-05-05"
      }
      [1]=>
      array(1) {
        ["DATE"]=>
        string(10) "2021-06-01"
      }
    }
  }
  ["internal-link-reverse"]=>
  array(14) {
    ["id"]=>
    string(1) "5"
    ["name"]=>
    string(21) "internal-link-reverse"
    ["title"]=>
    string(21) "Internal Link Reverse"
    ["type"]=>
    string(14) "articleslinked"
    ["label"]=>
    string(19) "internallinkreverse"
    ["default"]=>
    string(0) ""
    ["published"]=>
    string(1) "1"
    ["required"]=>
    string(1) "0"
    ["params"]=>
    array(24) {
      ["filter_categories"]=>
      string(1) "0"
      ["categories_inc_children"]=>
      string(1) "0"
      ["filter_tags"]=>
      string(1) "0"
      ["tags_inc_children"]=>
      string(1) "0"
      ["filter_language"]=>
      string(1) "0"
      ["language"]=>
      string(5) "nl-NL"
      ["filter_users"]=>
      string(1) "0"
      ["filter_customfields"]=>
      string(1) "0"
      ["customfield1_id"]=>
      string(0) ""
      ["customfield1_value"]=>
      string(0) ""
      ["customfield2_id"]=>
      string(0) ""
      ["customfield2_value"]=>
      string(0) ""
      ["customfield3_id"]=>
      string(0) ""
      ["customfield3_value"]=>
      string(0) ""
      ["linked_articles_ordering"]=>
      string(5) "title"
      ["linked_articles_ordering_direction"]=>
      string(3) "ASC"
      ["linked_articles_ordering_2"]=>
      string(7) "created"
      ["linked_articles_ordering_direction_2"]=>
      string(4) "DESC"
      ["layout"]=>
      string(5) "title"
      ["custom_field"]=>
      string(0) ""
      ["link_title"]=>
      string(1) "1"
      ["custom_html"]=>
      string(36) "[title] ([hits])"
      ["use_separator"]=>
      string(1) "1"
      ["separator"]=>
      string(2) ", "
    }
    ["group"]=>
    NULL
    ["language"]=>
    string(1) "*"
    ["multi"]=>
    string(1) "0"
    ["ordering"]=>
    int(5)
    ["value"]=>
    string(1) "1"
  }
}
"
    ["name"]=>
    string(14) "Organization 3"
  }
  [1]=>
  array(25) {
    ["id"]=>
    string(1) "1"
    ["slug"]=>
    string(46) "welcome-to-this-demo-site-of-joomlatools-pages"
    ["title"]=>
    string(77) "This website is a step by step demo of what you can do with Joomlatools Pages"
    ["summary"]=>
    string(0) ""
    ["category"]=>
    string(753) "object(ExtJoomlaModelEntityCategory)#2392 (16) {
  ["id"]=>
  string(1) "2"
  ["slug"]=>
  string(13) "uncategorised"
  ["title"]=>
  string(13) "Uncategorised"
  ["summary"]=>
  string(0) ""
  ["date"]=>
  string(25) "2021-04-20T12:29:24+00:00"
  ["edited_date"]=>
  string(25) "2021-04-20T12:29:24+00:00"
  ["author"]=>
  string(3) "844"
  ["editor"]=>
  string(3) "844"
  ["impressions"]=>
  int(0)
  ["direction"]=>
  string(4) "auto"
  ["language"]=>
  string(1) "*"
  ["parent"]=>
  NULL
  ["published"]=>
  string(1) "1"
  ["image"]=>
  array(0) {
  }
  ["name"]=>
  string(13) "Uncategorised"
  ["metadata"]=>
  array(4) {
    ["og:title"]=>
    NULL
    ["og:url"]=>
    NULL
    ["og:image"]=>
    NULL
    ["og:description"]=>
    NULL
  }
}
"
    ["tags"]=>
    array(0) {
    }
    ["date"]=>
    string(25) "2021-04-19T13:43:30+00:00"
    ["edited_date"]=>
    string(25) "2021-06-17T07:44:56+00:00"
    ["published_date"]=>
    string(25) "2021-04-19T13:43:30+00:00"
    ["archived_date"]=>
    NULL
    ["author"]=>
    string(3) "844"
    ["editor"]=>
    string(3) "844"
    ["image"]=>
    array(0) {
    }
    ["impressions"]=>
    int(0)
    ["direction"]=>
    string(4) "auto"
    ["language"]=>
    string(1) "*"
    ["published"]=>
    string(1) "1"
    ["archived"]=>
    string(1) "0"
    ["trashed"]=>
    string(1) "0"
    ["featured"]=>
    string(1) "1"
    ["links"]=>
    array(0) {
    }
    ["ordering"]=>
    int(4)
    ["metadata"]=>
    array(8) {
      ["og:title"]=>
      NULL
      ["og:url"]=>
      NULL
      ["og:image"]=>
      NULL
      ["og:description"]=>
      NULL
      ["article:published_time"]=>
      string(25) "2021-04-19T13:43:30+00:00"
      ["article:modified_time"]=>
      string(25) "2021-06-17T07:44:56+00:00"
      ["article:expiration_time"]=>
      NULL
      ["article:tag"]=>
      array(0) {
      }
    }
    ["fields"]=>
    string(48) "object(ExtJoomlaModelEntityFields)#2788 (0) {
}
"
    ["name"]=>
    string(46) "Welcome To This Demo Site Of Joomlatools Pages"
  }
}