The Cube - Assimilating Technology

The Cube

Joomla mambot for Google Maps

For Humans only


Joomla mambot for Google Maps Print E-mail
Monday, 26 November 2007 01:23

I recently required a map system, with directions, for a mambo based site I was constructing for my
father in law.
The basic requirements was that it was to be simple, easy to use, and direct any address to his place
of work.

Could not find one, but I did find a google map mambot ( created by Mike Reumer [ info at reumer.net ] )
which used the google maps api 2.

So I adjusted the code, and below is what I ended up with.

HOWTO:

NOTE (2008/11/26): This plugin/module does not seem to work in Joomla 1.5.x
When I get the time (or most probably, when I need it for joomla 1.5 ), I will convert/fix this.
a working example of the mambot can be found on http://www.alliancefasteners.com.au

Download and install the mambot using the standard Joomla mambot install path.

Get a google map api key (it's free)

Create a page with content, and stick the following code in the content. Note the space between
the start curly { and mosmap2 must be removed. It only exists here so that the mambot does
not activate. Remember to remove it!

{ mosmap2 |width='550'|height='400'|lat='-32.111780'|lon='115.812060'|zoom='4'|
zoomType='Small'|text='MARKER TEXT'|key='YOUR GOOGLE MAPS KEY'|
directionTo='ADDRESS OF PLACE YOU WANT TO DIRECT THEM TO'}

Mine looks like this:

{ mosmap2 |width='550'|height='400'|lat='-32.111780'|lon='115.812060'|
zoom='4'|zoomType='Small'|text='Alliance Fasteners
13 Coolibah Way
Bibra Lake
WA
6163
Australia'|key='KEY REMOVED'|directionTo='13 Coolibah Way, Bibra Lake, WA 6163'}

And that's it.

If you do not want the directions feature, just leave out the 'directions' tag that appears
after the google key.

On initial load, your normal map will display, and if the user types in an address,
and then submits the request, directions will be generated.
If the directions could not be generated, then the user will be notified, and the normal map will
display

Problems:

I have no idea how to adjust the print icon to generate the directions in the popup print view.
Any suggestions will be welcome.

You can try it below, use the example address that is given.....

I recently discovered that the cache setting for joomla/mambo stops the direction
lookup from working.
The reason for this is that the page load, after you submit your request is in fact the cached
page, so the request for direction is never received by the script.

You have two ways of dealing with this:

1. Disable global cache (not nice as the cache does improve performance)

2. Edit the cache script, to allow you to disable the cache for some page content.

Edit the file: /includes/Cache/Lite/Function.php and look for this line:

$this->save(serialize($array), $id$this->_defaultGroup);

Change it to:

if(!strstr($output,'<!--nocache-->')){
$this->save(serialize($array), $id$this->_defaultGroup);
}

now, in any article that you don't want cached, add the HTML comment <!--nocache-->,
and it won't be cached...

The change above was found here :
http://www.joomlaperformance.com/forums/func,view/catid,8/id,2100

Enjoy.

 

{mosmap2 |width='550'|height='400'|lat='-32.111780'|lon='115.812060'|zoom='4'|zoomType='Small'|text='Alliance Fasteners 13 Coolibah Way Bibra Lake WA 6163 Australia'|key='ABQIAAAAynN9QLfHIk6n8CUnWPFZJhRqI0HSoTOMhzbvbFlGjiF8SzR4NxTUZKKJYc7dXZZAEpiK8eQ9u3ds7w|directionTo='13 Coolibah Way, Bibra Lake, WA 6163'}

Last Updated on Friday, 26 February 2010 07:25
 
Share on facebook