Download & Extend

Calling a google map link in a template

Project:Location
Version:6.x-3.1-rc1
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I've been using the following to generate a link to google maps from within a node template:

<a href="<?php $linktext = location_map_link_us_google($locations[0]);
print
$linktext
?>
">Google Map</a>

However, this only works with US locations. I cannot figure out how to generate a link to non-us locations without including separate calls for each country. Can anyone help me out?

Thanks.

Comments

#1

Status:active» fixed

The function you want is location_map_link($location = array(), $link_text = 'See map: ')

if you say

print location_map_link($locations[0], 'See map: ');

It will print a hyperlink with the text "See map: Google Maps" and wrap it in a wrapper div.
If you have map links other than the google one they will also display in the wrapper div.
It will get the country information from the location passed in and work it out from there.

If you get undefined function errors you will have to make sure you include the location.inc file as the function lives there.
You do that by calling:

module_load_include('inc', 'location', 'location');

#2

Status:fixed» closed (fixed)

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