I just upgraded to 6.x.1.x-dev in order to fix the problem described in this issue: http://drupal.org/node/662390

Now the code in my theme doesn't work when I call theme('gmap' ...). I get the "Javascript is required to view this map" error. Strangely, the map that I'm using directly from views (no PHP code) works fine. I've compared the gmap javascript files on both of those pages and they appear to be the same. So, what's the problem? I'm stumped.

Here's the code that I can't get to work:

<?php
$behvr = array('autozoom');
                        $markers = array(
                            array(
                                'longitude' => $node->location['longitude'],
                                'latitude' => $node->location['latitude'],
                                'text' => $node->title
                              )
                        );
                        
                        $map_array = array(
                            'id' => "farm-map",         // id attribute for the map
                            'width' => "250px",        // map width in pixels or %
                            'height' => "250px",      // map height in pixels
                            'latitude' => $node->location['latitude'],    // map center latitude
                            'longitude' =>$node->location['longitude'],  // map center longitude
                            'zoom' => 12,              // zoom level
                            'maxzoom' => 15,
                            'maptype' => "Satellite",       // baselayer type
                            'controltype' => "Small",  // size of map controls
                            'markers' => $markers,

                          );
                          gmap_gmap('pre_theme_map',$map_array);
                          $output1 = theme('gmap', array('#settings' => $map_array));
                          echo $output1;
?>

I've also tried making this work with views_embed_view but that won't do it either.

Comments

robynover’s picture

Component: Code » Miscellaneous

Update: the code I posted is a little wacky, but the problem remains. I can't get GMap to generate the appropriate .js and add it to the page when I embed the map with theme_gmap or with views_embed_view. All I am trying to do here is essentially pull in the node map in a template.

It seems that I can make it work when I write my own "jQuery.extend(Drupal.settings..." which works fine for a single node, but for the case of many nodes at once, it would be much better if it were dynamic.

Pulling my hair out here ... any ideas?

johnv’s picture

Status: Active » Closed (won't fix)

Closing this very old issue. Please reopen if it is still valid.