Above problem solved:
The javascripts was not automatically added to the header because the snippet was called uncached and the document was set to not cacheable. There is a bug in 0.9.2.1 that it doesn’t add the scripts under these circumstances. Fix is to set the document to be cached or change the snippet call to cached.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
I seem to have the problem of the map being displayed with no marker, below is the call.
[!GoogleMapMarker? &apiKey=`ABQIAAAAXRc3ux_EqbCe8bFxzSLOvRSrwFah6sw7ECeyvYp9iBvJVRv7phRnPAFTj_Nz3iboAySEJvBZoKR3tw` &mapControl=`small` &mapTypeControl=`none` &defaultZoom=`16` ¢erPos=`-40.357713,175.611434` &startID=`122` &tpl=`GoogleMap`!]
The page is set to cacheable and the script is added to the header
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAXRc3ux_EqbCe8bFxzSLOvRSrwFah6sw7ECeyvYp9iBvJVRv7phRnPAFTj_Nz3iboAySEJvBZoKR3tw"></script>
StartID is set to 122, which has a child document of 123. The description filed of the document has the location, which is "-40.357713,175.611434" (without quotes). Could the fact that it has a - have anything to do with it?
As usual it is in my Sandbox
Use the Javascript console in Firefox to see what problems the script is probably causing.. there are some things that you need to be aware of when making marker documents:
- You need to escape all single quotes and brackets with backslash (plus maybe some other chars too).. eg. ’ becomes \’ and ( becomes \( etc.. in title field too.
- Don’t publish the marker documents.. or if you want to publish them, use &showOnlyPublished parameter
- Make sure that marker document content does not span to multiple lines (disabling RTE for markers is the best way to achieve this)
Some of these issues will be fixed when I get the time to do a new version of this snippet. I have planned to use more of Google map api features such as driving directions, marker images, rulers etc.. but currently, I don’t have time to look at this.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Quote from: doze at Oct 01, 2006, 03:37 PM
Don’t publish the marker documents.. or if you want to publish them, use &showOnlyPublished parameter
That fixed it, mine was published in an unpublished folder. Cheers.
Hi, i was just wondering i have the make maker working and i think it is great, but it puts the map inside <p></p> is there any way to display the map without putting it inside the paragraph tags? thanks lach.
I believe it’s your RTE that’s doing this. You can remove the paragraph tags if you use the "source" button of your RTE or by disabling RTE altogether... There is also a configuration setting in the rte’s that you can switch to disable it automatically wrapping everything in paragraphs.. You can find help on this issue by searching the forum (use google).
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
hi, doze thanks very much!!! i disabled RTE and it fixed it perfect.. thanks lach.
Hi All!
I am VERY new to MODx and of course this snippet. Both seem to be great! Thanks to all involved!
Now, the questions...
1. Does the license allow mods to the script?
2. Has anyone tried a mod that would return a lat/lon rather from a user click on the map in addition to or in place of having a list of locations to choose from?
On #2 I’m thinking that it would be a very useful tool when coupled with other utilities like Googles Geocoding, weather sites, etc.
Thanks,
joe
1. Do anything you want with it.
2. Not that I’m aware of. You mean that when user clicks on the map, just anywhere, it will show the latitude/longitude of that position? Or do you mean that it would show the lat/lon in the marker popups when user clicks them, instead of the document content?
Google maps API has evolved greatly from when I did this snippet and also Ditto (what is used in this snippet) has opened new possibilities. I have thinked about including driving directions feature in next version if I do one, but have been waiting for google to make it possible in Finnish maps too. It is possible allready at some stage with geocoding so it could be time to look at this soon..
I don’t use this my self, just did it for a friend that needed one. So if you have any wishes for the next version, list them here! That goes for anyone.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
What i was thinking of was not that it would display the coordinates, but it would return the coordinates as well as the click event. This could be used to trigger another routine (don’t know what the correct MOBx lingo is yet) such as one that would display the forecast for that location or the traffic conditions, population density... or whatever.
Perhaps the map routine could even be equiped with a listener registration so that one could tie arbitrary routine(s) to the map click event.
Just thinking out loud here... I have a long way to go before I start working on this stuff.
joe