no results fallback

pie

Member
Hi, as the title suggests:
I'd like to avoid the sadness of an empty table when no results are found:
I thought I could
  • show related results at the bottom of the page
  • perform another query or redirect to url (where I could have another query set up)
  • include all results in the first query, group them by the element the query was on (so that matching results appear before) and find a way to style the other results differently

Is there a built-in fabrik feature that i missed to do any of this?
If not, how do/would you do?

Thank you
 
Nope, nothing built in. Easiest would probably be your second option, of redirecting. You could use a php_events list plugin, with some code on the 'onLoad' event which looks at the list data, and if it's empty, do a redirect.

List data will be in $args[0]->data[], where data is an array of arrays (groups of rows). If no rows, data will have a single entry (one group), itself an empty array.

Code:
// use the emptyish() array helper func (which counts a single empty array as empty)
if (FArrayHelper::emptyish($args[0]->data[0])) {
   $app = JFactory::getApplication();
   // optionally enqueue a message
   $app->enqueueMessage('No results found, blah blah');
   // redirect
   $app->redirect('index.php?blah');
}

-- hugh
 
cool! thanks

For the records, I had to "discover" the php_events plugin after it was "installed successfully" using J! installer
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top