I am running Drupal 4.7.2. I have installed the latest versions of 'printer friendly pages' module and Gmap module (http://drupal.org/node/33591). Printer friendly pages module is working perfectly for all pages. Gmap module is also working fine.

However, when I view a printer friendly page and the original node contains a gmap, the gmap is not displayed. Internet Explorer 6 shows an error message that 'problems on this page might make proper presentation of this page impossible'. Firefox 1.5 does not give a warning, but doesn't display the gmap either.

This 'bug' is unfortunate, because maps are often printed for use when traveling.

Comments

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

Can you try with the latest 5.x dev release?

jcnventura’s picture

Project: Printer, email and PDF versions » GMap Module
Version: 7.x-1.x-dev » 5.x-1.x-dev
Component: Miscellaneous » Code
Status: Postponed (maintainer needs more info) » Active

Nobody answered, but I have tested this, anyway.

This can't get solved because the Google maps API requires a different key depending on the location of the page. So a page residing in www.example.com/print will require a different key than a page in www.example.com/content.

So, basically there's a choice between being able to show the gmap in the printer-friendly version page or in the original page. I think that most content writers will go for the latter..

Until Google changes their API (or the gmap module is able to handle several keys, this can never get fixed).

Because maybe the latter is a more feasilble possibility, I am moving this issue to the gmap module.

João

jcnventura’s picture

Status: Active » Closed (duplicate)

The need for different keys is covered by http://drupal.org/node/185750

bdragon’s picture

Status: Closed (duplicate) » Active

That is only correct if you accidentally generated your key for www.example.com/content instead of www.example.com.

Always generate your key against the drupal root folder!

sl27257’s picture

Might be related to the following which fixed it for me.

http://drupal.org/node/217439

/Thomas

jcnventura’s picture

Project: GMap Module » Printer, email and PDF versions
Status: Active » Closed (duplicate)

Yes,

It was actually a combination of both. When I tried to test this, I read Google's terms which stated that I needed a key per directory. Since print uses it's own path (/print) I thought that there was no way to solve it without multiple key support. So I reported it to this module.

I had to wait for your later bug report with the explanation of why it didn't work to understand what the problem was.

Since the problem (and the fix) are all the responsibility of the print module, I am moving back the issue there. And I am marking it as a duplicate of #217439: Include Java-script in the header so that e.g. Google-maps, can be printed.

João Ventura

halver’s picture

Sorry to be so clueless, but did this ever get resolved? I'm having the same problem, using Drupal 6.10 and Printer, e-mail and PDF versions 1.4. I have inserted the 'location map' block into the page using Composite Layout and it does not show up in the printer friendly version. Is it perhaps because of the Composite Layout module?
Thanks, and again, I'm not very proficient at this stuff yet, so your reply will need to be as basic as possible.

h3000’s picture

Hi,

I also have this same problem.

I added the following code in my print.node-content_type.tpl.php file:

if (function_exists("gmap_gmap")) {
$markers = array();
$markers[] = array(
     'latitude' => $node->location['latitude'],
     'longitude' => $node->location['longitude'],
     'markername' => 'drupal',
     'offset' => 0,
     'opts' => array('title' => $node->title),
);
$macro = variable_get('gmap_location_block_macro_'. $node->type, '');

if (empty($macro)) {
     $macro = variable_get('gmap_location_block_macro', '[gmap |width=100% |height=200px |control=None |behavior=+autozoom +notype]');
}

$map = gmap_parse_macro($macro);
$map['latitude'] = $node->location['latitude'];
$map['longitude'] = $node->location['longitude'];
$map['markers'] = $markers;
gmap_gmap('pre_theme_map', $map);

}

//display location map
print '<div>';
print theme('gmap', array('#settings' => $map));
print '</div>';

However, when I view the page (the printer friendly page), it only shows a string that says "Javascript is required to show this map...".

The node has a location set for it and the map appears when viewing the normal full node page.

My setup is:
Printer Friendly Pages 6.x-1.6
GMap 6.x-1.1-rc1
Drupal 6.12
Apache 2
PHP 5
MySQL 5

Thanks for any information

jcnventura’s picture

Version: 5.x-1.x-dev » 6.x-1.6
Status: Closed (duplicate) » Postponed (maintainer needs more info)

Can I access an URL with this map? I need to check one thing..

I am suspecting that the gmap module is not doing something right, but I need to confirm it.

João

h3000’s picture

Hi João,

The following is a printer friendly version of a node with a map that is supposed to appear at the bottom of the page:
http://www.shenzhenparty.com/print/34829

Only the text "Javascript is required to view this map." is appearing.

Thanks

jcnventura’s picture

The original page doesn't show any map nor any reference to gmap.. I am assuming that you're setting up a print.tpl.php that does include the gmap.

If so, then you need to make sure that the gmap javascript include is added to the output.. You'll have to add it manually in the template, as the page generation by the print module reuses all the includes of the original page.

h3000’s picture

Hi,

Here is another url: - http://www.shenzhenparty.com/print/28369 - location blocks are only appearing for admin users - not yet enabled for other users - its only enabled on the printer friendly version for this.

How do I include the javascript? I have the following lines in my print-node-content_type.tpl.php file:

- <script type="text/javascript" src="sites/all/modules/gmap/js/gmap.js"></script>
- <style>@import "sites/all/modules/gmap/gmap.css";</style>

However, the result is still the same.

Thanks

jcnventura’s picture

One feature of relative paths is that they're relative to the current path.. By setting these paths to 'sites/all/...', the browser will try to load them from hxxp://www.shenzhenparty.com/print/sites/all/...

Simply add a '/' to the beginning of the path and I think it should start working.

jcnventura’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

No further info in 2 weeks. Closing the issue.