Search

So I've got a standard datasources that filters by a page parameter, so if the parameter isn't set, all items are returned, and if the parameter is set only the item that matches the filter is returned.

What I really want is to have a generic value for the parameter that will also return all items. Is that possible?

E.g. /events/event-1/ returns a match for "event-1" whereas /events/all-events/ returns all events, just as /events/ would. I'm trying to do this so that I can filter on a second parameter, e.g. /events/all-events/city/.

I've got a sneaking suspicion that this is possible by customizing the datasource file, perhaps via _force_empty_result somehow? I'm just not very knowledgeable about PHP, unfortunately.

is possible by customizing the datasource file

Correct. Inside the grab() function you will want to check for the value of the URL parameter, and if it is "all-events" then remove any filtering on that field.

// "param" is the name of your URL Parameter
if($this->_env['env']['url']['param'] == 'all') {
    // 123 is the ID of the field you are filtering on,
    // look at $dsParamFILTERS at the top of your data source
    unset($this->dsParamFILTERS[123]);
};    

Awesome, Nick, that works perfectly. Thanks!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details