Search Page with Exposed Filters

ryan88 - August 9, 2009 - 01:04

I am creating a search page using views, and I have the page working, but I want to start to fine tune the way it looks. I have about 5 different exposed filters, but they are all in 1 large block, and I want to separate them out a bit more into separate "blocks" kind of like the way drupal.org does it. http://drupal.org/project/modules. The way the right sidebar has each search portion in a separate container.

My other problem is that when someone initially visits the page, it is blank, and then you have to do a search to get something to display. I want the page to initially list everything, and then for users to be able to narrow the results using the exposed filters.

Any help would be much appreciated as I am still new to Drupal and Views.

There is a very brief video

mlle.yotnottin - August 9, 2009 - 02:50

There is a very brief video tutorial over at http://civicactions.com/blog/2009/apr/28/views_filter_blocks_drupal_6 that you might find useful. Views has a setting named "Exposed form in block" that should allow you to achieve views block nirvana.

As far as the initial blank page, if you are using arguments in your view, one of the settings for the argument form is "Action to take if argument is not present". You might want to explore that a little bit to see if anything useful turns up.

Good luck!

Mlle.Yotnottin

All that really showed is how

ryan88 - August 10, 2009 - 02:34

All that really showed is how to move the filter into a block, which is great an all, but I still need more advanced themeing of the filters. Anyone else have a suggestion?

Theme with views-exposed-form.tpl.php

ryan88 - August 10, 2009 - 04:52

So I figured out that you can theme the exposed filters with views-exposed-form.tpl.php and I got the right look, but I am still stumped about the blank initial display. From what I have figured out, it is supposed to default to displaying everything, and then be able to search down, but my view does not do this when I expose the Distance/Proximity filter from the Location module.

By playing with the settings

ryan88 - August 10, 2009 - 16:32

By playing with the settings a bit more, I discovered that the reason that it showed no results on the initial display is because there was a default distance setup in the view. So when you initially tried to go to the page, it saw the distance, and then looked for a zip code, and didn't find one. So by deleting the default distance, I am able to show all nodes on the initial load. The only problem is that by having the radius blank, it is just another step that users have to fill out in order to do a search. Ideally, I would like to just have a few radio buttons for radius and not have the box at all, but I am not sure how to do that, so for now, I will just live with it the way it is.

 
 

Drupal is a registered trademark of Dries Buytaert.