gmap location block on taxonomy/term pages

teagle - November 27, 2007 - 13:57
Project:GMap Module
Version:6.x-1.0-rc2
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hello,

I'm sure I'm missing something straightforward, but...

Can I put a "Location Map" block on a taxonomy/term list page and get a marker for each teaser/node that is listed? I'm running up against brick walls.

I've got gmap and location modules working fine on individual nodes on a tourism site currently being developed. But we would like to use a single content type categorised with multiple taxonomy terms for almost all the site's content, and allow visitors to access the built-in taxonomy/term list pages (with clean urls eg www.myexample.com/vocabulary/term-name rather than the standard taxonomy/term-id). Each term's list page should show a gmap block with markers for each of the nodes corresponding to that term. At the moment, the nodes that get listed have lat/long information in <abbr> tags but this information isn't getting to the Location Map block I've put on every page.

I've also tried using Views (with argument_api - unsuccesfully... again, I'm sure I'm missing something obvious) but can't get the taxonomy term to be passed to the Views-created block. I'd prefer to avoid using Views if it means creating a separate View for each taxonomy term.

In the various use cases and documentation and support requests, I've seen lots of content-type based filtering in gmaps, but not much taxonomy filtering.

Does anyone have any suggestions?

Thank you very much!

#1

teagle - December 8, 2007 - 09:50

so far the only way around this I've found is:

a) create an RSS view for each relevant taxonomy term, thereby avoiding the standard drupal rss mechanism's problem of limiting posts to 30 in the feed
b) create a gmap macro that reads from the rss feed, put it in a block and set it to show up on the relevant url ...vocabulary/term-name url alias

it's laborious on a site that makes heavy use of taxonomy and it doesn't allow for adding new taxonomy term pages with gmaps automatically in the future.

As I said before, I'm sure I'm missing something obvious... any pointers (or even confirmation of similar experiences) would be much appreciated.

#2

bdragon - January 5, 2008 - 02:55

You can use the argument handling code in views to get the taxonomy term passed in.

Use the argument "Taxonomy: Term ID", and use this for Argument Handling Code: return array(arg(2));

I assume you're adding aliases to the regular taxonomy/term/* pages, right?

#3

teagle - January 19, 2008 - 13:44
Status:active» closed

Thank you bdragon - the argument handling code worked perfectly. Sorry for taking so long to try it and let you know. Not the right place to say this, but thank you so much for the gmap module... it's a real gem, especially the new version with the taxonomy markers and all the new features...

#4

Summit - November 6, 2008 - 10:32

Hi Thomas,

Could you post the view you use for this, including the argument handling code?
Thanks a lot in advance for considering this!

greetings,
Martijn
www.trekking-world.com

#5

wgrunberg - December 2, 2008 - 05:24

I would like to see the argument handling code too.

#6

Summit - January 4, 2009 - 08:36

Hi,

What solution is there for this in D6?
Thanks a lot in advance for answering!

greetings,
Martijn

#7

tootsietorres - January 28, 2009 - 13:30
Version:5.x-1.x-dev» 6.x-1.0-rc2
Status:closed» active

I have been trying to do this exact thing for over a week. I have been reading the forums and banging my head, but I just can't seem to make it happen.

I also have a block that will show up on an individual node. The nodes are a custom CCK type and use the Location module. All are fine. But each node also has a taxonomy term associated with it. And on the respective taxonomy term page (taxonomy/term/tid) I would like a *block* that maps the associated nodes. It seems like such an easy concept, but I just can't seem to make it happen.

I have tried the argument handler from above. Also, some other PHP snippets I have found. And of course an assortment of Views 2 settings. Any guidance would be greatly appreciated.

Tootsie

#8

Summit - January 28, 2009 - 13:35

Hi Tootsie,

Do you mean something like: http://www.reizen-naar.nl/wintersport-0 ?
If so, I can help you get this working.

Greetings,
Martijn

#9

tootsietorres - January 29, 2009 - 19:02

Martijn,

That looks like it, assuming it works with a taxonomy term.

Tootsie

#10

tootsietorres - January 29, 2009 - 19:36

After reading some more comments, I came across this snippet which gives me what I want for the moment:

if (arg(0) == 'taxonomy' && arg(1) != '') {
return arg(2);
}

I put that into Views 2 default argument configuration for Taxonomy:Term ID.

Now, the problem is on any page that is not a taxonomy term page, I get this huge list of errors. Can I stop it from doing that? Are these errors serious?

* warning: Invalid argument supplied for foreach() in /home5/realetf6/public_html/sites/all/modules/views/includes/handlers.inc on line 794.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /home5/realetf6/public_html/sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc on line 72.
* warning: implode() [function.implode]: Invalid arguments passed in /home5/realetf6/public_html/sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc on line 72.
* warning: Invalid argument supplied for foreach() in /home5/realetf6/public_html/includes/common.inc on line 1600.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT * FROM term_data WHERE tid IN () in /home5/realetf6/public_html/sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc on line 77.
* warning: Invalid argument supplied for foreach() in /home5/realetf6/public_html/sites/all/modules/views/includes/handlers.inc on line 794.
* warning: Invalid argument supplied for foreach() in /home5/realetf6/public_html/sites/all/modules/views/includes/handlers.inc on line 794.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /home5/realetf6/public_html/sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc on line 72.
* warning: implode() [function.implode]: Invalid arguments passed in /home5/realetf6/public_html/sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc on line 72.
* warning: Invalid argument supplied for foreach() in /home5/realetf6/public_html/includes/common.inc on line 1600.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT * FROM term_data WHERE tid IN () in /home5/realetf6/public_html/sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc on line 77.
* warning: Invalid argument supplied for foreach() in /home5/realetf6/public_html/sites/all/modules/views/includes/handlers.inc on line 794.

#11

etcetera9 - October 25, 2009 - 19:11

Solution on comment #2 (http://drupal.org/node/195715#comment-679308) works nicely for me...

thanks...

 
 

Drupal is a registered trademark of Dries Buytaert.