I am creating a search functionality in Drupal by exposing filters within View. The problem is that I would like to add also a Google Map that display the location of nodes, apart from the search results (node title and some other fields). I can easily do one or the other but I find it difficult to display both search results in a standard way and the map below it. The reason for that is that I cannot choose mmultiple styles within views - i.e. Gmap and HTML list. Any ideas how can I achieve that? Maybe it is possible by showing 2 separate views within one page, but how to pass the parameters? Any help will be appreciated.
A:
Create a Page view, and the Gmap can be a Block display view. Then you can add the Block to a region, and set the display path to the same value as your Page.
Kevin
2010-07-21 19:32:27
This may not work because there is filtering of the view happening through the exposed filter. What Vafello wants is the map should only show the filtered nodes and the gmap for the filtered nodes.
Sid NoParrots
2010-07-22 16:50:25
+2
A:
This is an interesting question. Its definitely doable.
The solution lies in creating a Views Attachment Display for the gmap style (just like Page Displays and Block Displays there are Attachment Displays). First google around and understand the concept of a views attachment and learn how to create a simple one.
When you create a Views attachment display you need to specify which display to "attach" your view too. Subsequently in the attachment settings make sure you set "Inherit Exposed Filters" to "yes".
Briefly here are the steps in serial order
- Create a Page View for your search results (Node title + other fields)
- Create your exposed filters in the Default Display (so that it is available to all Views displays)
- Create an attached view with the gmap style. Note that since the exposed filter was created in the default display it should be available in the attached view also
- Make sure the attached view is attached to the Page display you created in step 2
- Make sure the "Inherit Exposed Filter" setting is Yes for the views attachment.
- Profit!
Sid NoParrots
2010-07-22 17:21:12
Wow, that's really awesome!No wonder you provide Drupal training. I started to use Drupal 10 days ago and I'm shocked how powerful it is. Thanks a lot!!
Vafello
2010-07-22 23:08:00