I have this problem with printing the map on the content block. Map works if I put it to left or right sidebar, but no if put the block to content. Can anyone help me with this issue?

Comments

the greenman’s picture

Hmm. Have you got anywhere I could look ? If you can get me a url I could look at ?
It's probably something to do with the jquery lookup.

irkop’s picture

I added the map to the content part of the page so you can see that it doesn't show anything. It should show Helsinki's location as it is on the page. I also tried to make new areas in the template file, but that didn't help me neither. It just works on the left and the right sidebar.

Here's the link to the site:
http://dev.filipgigic.com/node/1/

the greenman’s picture

For some reason, the geomap js file is not being added.
Have you manually added the content map div ? If so, you will need to manually call the drupal_add_js function.

irkop’s picture

What do you mean by manually added? It's the content area that came with the drupal installation. I've just implemented my own template to it. I just added the geomap block to the content area.

the greenman’s picture

Hmm. Ok looks like the way the content section of the theme is rendered may be different to the other regions.
Headers may have already been sent when the theme function is called.

This the important stuff

drupal_set_html_head('<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='. $google_key .'" ></script>');
    drupal_add_js(drupal_get_path('module', 'geomap') .'/jquery.googlemaps.js', 'module'); 
    drupal_add_css(drupal_get_path('module', 'geomap') .'/geomap.css', 'module');

An immediate solution would be to add this code to the top of your template.php.

if ($google_key = variable_get('googlemaps_key', '')) {
    drupal_set_html_head('<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='. $google_key .'" ></script>');
    drupal_add_js(drupal_get_path('module', 'geomap') .'/jquery.googlemaps.js', 'module'); 
    drupal_add_css(drupal_get_path('module', 'geomap') .'/geomap.css', 'module'); 
}

It wont be a "nice" solution, but it will get you working. I will need to look into a better way to add the files in the future.

jjchinquist’s picture

Status: Active » Fixed

Setting to fixed as after the comment from Greenman it has no longer had activity.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.