Posted by rizzo on June 7, 2010 at 11:03pm
I have a test site with gmap/location/views combo. Everything is working great now. The view filters the nodes based on an event date (think of it as a map of today's bake sales). The one thing I don't like is that if there are no bake sales today, it doesn't even render an empty map. I wonder if it would be possible somehow to draw an empty map or maybe otherwise write a message to the page?
Comments
Can't you use the 'empty'
Can't you use the 'empty' text for one of the fields? Possibly the 'Location address' field. Bear in mind someone may add an address without that field & prevent it showing up on that view.
?
I'm not following you. Right now I filter on node type = bake sale and date = now. Nodes are mapped via gmap click, regardless of the other Location fields.
Sorry, I may have
Sorry, I may have over-assumed :)
It sounds like your view is using the 'row style: Node' ?
I was assuming you were using 'row style: Fields'.
It will be more work because when using the fields style you don't automatically get the map to display on the output. It requires another view to be 'attached' to show the map, but when using fields you can at least specify text to be used instead of empty values.
It took me a while to get working, so I ended up creating a 'view export' for others to try, check out
http://drupal.org/node/386848#comment-1696524 and try importing the view on a test site.
I'm also assuming you are using 'Location cck fields' not the location module that tags a location onto nodes (boy this is confusing :^) )
Good luck
Row style is Fields I am NOT
I'm not sure what you mean by "more work". I created a page display and it works like I think it should.
I couldn't use the location
I couldn't use the location module because it wasn't flexible enough when I was setting up a site, it may not be flexible enough for you either.
Is there an 'Empty text' field when you are working on the settings for the location - here is how it looks for a Location CCK field the 'empty field' is selected near the bottom of the image.
http://dl.dropbox.com/u/59660/location-cck-empty-text.png
It may be a limitation of the location module that is preventing you from setting this value. There may be a way around it via locations configuration, but I'm afraid I don't use that module.
Yes
Yes I have that field with the normal location. I'll play with it, but I don't see how that helps if there are simply no nodes that match the date filter.
As I thought
It doesn't change anything. If there are no nodes matching the date filter, the view won't render a map. It only does so when there is at least one node to display.
Sorry, I have sent you on a
Sorry, I have sent you on a wild goose chase.
You can enable the gmap macro builder module & then create a macro & add that to the empty text for the view.
Add something like the following to the 'empty text' in the views basic settings…
[gmap zoom=15 |center=51.511092905004745,-0.09136676788330078 |width=396px |height=396px |control=Small |type=Map]
The empty text field will need to use an input filter that will parse the macro & convert it to a map, check your input formats & create one specifically for gmap macros, enable the 'GMap macro expander' in that input format.
Hope that helps.
thank you!
great i've been wondering how to do thsi for weeks!
Excellent, good trick
Excellent, good trick
Macro in Empty Text field yields Javascript error
If I try to use a Macro to display a default map as an Empty Text I get a Javascript error.
I'm using exposed filters, so that may be a problem. Any ideas?
EDIT: The gmap macro input format cannot contain HTML formatting also, it seems. Works fine now.