Wanted to work out how to do the text and pictures shown in the gmap demo but could find nothing in the README or anywhere else.

I eventually worked out from reading the source of the module that I needed to define the marker as x,y:Text which will then display "Text" in the marker. Thats as far as I got - still don't know how to do links or images in there. Can you please write up some docs on the gmap code format that the module expects so we can expand on the code built by the macro?

Many thanks

Comments

webgeer’s picture

Assigned: Unassigned » webgeer

It is definitely in my todo list. The README hasn't really been updated since the version 4.6 one, but a lot of new features have been updated.

"text" can by any html text including links img tags etc. The only forbidden character is a "|" as that is used to signify the end of the text.

pgregg’s picture

Thanks.

I tried using e.g. test and link but they just rendered the full html in the box...
In the "filtered html" settings gmap runs after the html filter (gmap is weight 10, html 1 - defaults)

Thoughts?

webgeer’s picture

Do you have the html filter set to strip out and ? I don't think you can/should be able to let someone put a link on the map that you wouldn't let someone put on the page. The html filter is required to run before the gmap filter, so that is correct. I created a new input format that just has HTML filter (priority 1) and GMap filter (priority 10) on it and then created a new node with the following text in it:

This demo should have a marker with an html and the other with bold text.

[gmap |id=maplinks |center=-123.10043334960937, 49.19965350270188 |zoom=7 |width=600px |height=400px |align=None |control=Small |type=Map |markers=-123.1292724609375,49.18619152703722:Here is a <a href="drupal">link</a> to drupal + -123.0853271484375,49.243603762131194:This includes <strong>bold</strong> text]

This creates the page shown on http://www.webgeer.com/node/16 which works correctly for me.

When you create a node with that text what do you get?

webgeer’s picture

obviously what I meant to ask is whether you have html filter strip out <a> and <b> tags

pgregg’s picture

Seems I had a misunderstanding on the HTML tags exception - I had it set to escape all tags... I mistakenly blieved the Allowed HTML tags would not be escaped.

However, despite correcting that, I've now hit a show stopper! :(

For some reason when I attempt to access any map now (gmap setting is Dynamic) I get a javascript error:

gmap_torun is not defined.

looking at the source (of the rendered html page), I see that it never sets up var gmap_torun... odd - why'd it just stop working?

If I switch the setting to "Static" I get errors: "Expected ',' or '{' but found '*'. Ruleset ignored due to bad selector" on *every* page.

Regardless - the map nolonger renders on the page.

I went to admin modules and deactivated the gmap module, then reactived it again and it rendered once and no more.

The only thing I can thing of that changed was I added a second user location. I've since deleted all the entries on gmap_user table, and disabled user maps, but I'm still broken. :(

webgeer’s picture

It has to be set to static. (The nocache for modules doesn't seem to work yet under drupal 4.7 -- or I am trying to use it incorrectly. )

I assume you are using firefox. I'm also asuming it works fine using IE. When you get the error:

Expected ',' or '{' but found '*'. Ruleset ignored due to bad selector

This pops up in a javascript notice box and if you continue, the map should still show up.

This is exactly how it is supposed to work according to the googlemap api documentation. You probably shouldn't have the javascript error reporting set so high in firefox. I think think this is a method that google recommends to have it so the style is not set in Firefox, but is set in IE.

If it does not work as I suggest, please give me a link to the page, or do a view source and email me the source for the page so I can try and figure out what the problem could be. You can send me an email at james at webgeer.com

pgregg’s picture

Thanks for the prompt replies.

I did a bit more digging and I found that in my pages I have a plain old tag with no onload() - however I'm not even sure there should be one there - looks like the javascript changes it behind the scenes...

Anyway, in gmap.module, I found:

# Not used in Drupal 4.7 due to a bug in Drupal 4.7
function gmap_onload() {
if (strlen(variable_get('googlemap_api_key', ''))>0) return array('gmap_onload()');
}

which was /* */ commented out. For kicks I removed the comments so that it would run, and the map displays all came back.

I've also been able to confirm that html in the map now works :)

Thanks,

Paul.

webgeer’s picture

Status: Active » Closed (fixed)

I have fixed the in-line documentation to some degree and I have also done a much more extensive documentation of the macro structure on the website: http://www.webgeer.com/gmapdemo

I recognize that it is far from excellent, but as this is going to be a never-ending part of the project, I will close this issue now. If someone has some specific suggestions for improving the documentation (and best provide some of these documents) I would love it.