Drupal Views in Panels No Results Behavior

mrroy69
mrroy69 used Ask the Experts™
on
I have a view setup based on contextual filters for example arg1 and arg2 that pulls the results from a content type, with arg1 being the main category and arg2 being a subcategory of that main category

I’ve also added a Global View Area for "NO RESULTS BEHAVIOR"...Where it would show the parent category results if there is no subcategory results. It works on the view for the no results behavior, but the no results behavior is not working on the Panel.

For example on the view page in the Update Preview section I can type for example:

food/berries - which would show the berries results because they exist

However food/cheese would show the results for the parent category food, because no results exist for cheese.

So everything here works like it's supposed to.

The problem is that in Panels it doesn't behave like that, it only shows content if the results for the subcategory exists and doesn’t inherit the NO RESULTS BEHAVIOUR form the view.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
OK I figured this out. I needed to change  the "Action to take if filter value does not validate" to in my contextual filter "display contents of No result found".

I also need to change my custom view tpl page

FROM

<?php if ($rows): ?>
      <?php print $rows; ?>
  <?php endif; ?>

TO

<?php if ($rows): ?>
      <?php print $rows; ?>
   <?php elseif ($empty): // this prints the no results behaviour
 ?>
      <?php print $empty; ?>
  <?php endif; ?>

Author

Commented:
Persistence pays off!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial