I have a view with exposed filters which only returns results when a filter is applied and it all works fine. I also have a block underneath the view which I only want to show before a filter is applied. I have set the block only to display on a url for example


which is the path of my view, when you apply filters the url path becomes


at this point I don't want to display the block

1 Answer 1


Turn on php filter module shipped in core, so to get option to add php codes option to set block visibility at the block configuration.

Remember you have to make sure, php code should be appropriate else it will not allow to access the site till you delete the added php codes from database for the block.

Code which might help you

  if ($_GET['q'] == 'view' && count($_GET) == 1) {
    return TRUE;  // block will be shown
  return FALSE;
  • i had got so far with the above answer but had missed off && count($_GET) == 1 Commented Oct 17, 2013 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.