[solved] How to popup a Googlemap based on latitude and longitude passed as para
Posted: Mon Oct 06, 2008 1:28 pm
Helllo,
For a large gallery of photos, I want to allow the viewer to open on each photo page a popup window containing a Google map centered on the photo location. I know how to
1) generate the map (using {SimpleGoogleMap map='mymap' lat='43.717788' long='10.399592'})
2) open a popup using the UDT below({popup url='generic_map_page' width='300' height='300', text='Click here to get the position of the photo on a map'}
But how can I pass the latitude and longitude from the parent page to the popup page ?
My galleries contain 1000 photos. Of course, I could create 1000 popup pages using hard-coded relevant latitude an longitude for each, but it looks rather clumsy.
In fact, I need to use a sort of new UDT "popup_SimpleGoogleMap" using paramaters
url (for generic_map_page)
width
height
text
latitude
longitude
Does anyone have ideas ?
Thanks
François
Code used for the popup :
// Verifiy UDT parameters.
global $gCms;
if (! isset($params['url']))
{
return;
}
else
{
$url = $params['url'];
}
if (isset($params['width']))
{
$width= $params['width'];
}
else
{
$width = 0;
}
if (isset($params['height']))
{
$height= $params['height'];
}
else
{
$height = 0;
}
if (isset($params['text']))
{
$text = $params['text'];
}
else
{
$text = "Click here";
}
// Insert script into output stream.
echo '
xMax)
{
w = xMax;
}
if (h yMax)
{
h = yMax;
}
// Center on screen.
var x = screen.availWidth / 2 - w / 2;
var y = screen.availHeight / 2 - h / 2;
var options = "";
options += "toolbar=no, location=no, directories=no, status=yes, ";
options += "menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, ";
options += "dependent=yes, ";
options += "width=" + w + ", height=" + h + ", left=" + x + ", top=" + y;
var popupWindow = window.open(url, "PopUp", options);
}
// -->
';
// Insert anchor tag into output stream.
echo "$text";
For a large gallery of photos, I want to allow the viewer to open on each photo page a popup window containing a Google map centered on the photo location. I know how to
1) generate the map (using {SimpleGoogleMap map='mymap' lat='43.717788' long='10.399592'})
2) open a popup using the UDT below({popup url='generic_map_page' width='300' height='300', text='Click here to get the position of the photo on a map'}
But how can I pass the latitude and longitude from the parent page to the popup page ?
My galleries contain 1000 photos. Of course, I could create 1000 popup pages using hard-coded relevant latitude an longitude for each, but it looks rather clumsy.
In fact, I need to use a sort of new UDT "popup_SimpleGoogleMap" using paramaters
url (for generic_map_page)
width
height
text
latitude
longitude
Does anyone have ideas ?
Thanks
François
Code used for the popup :
// Verifiy UDT parameters.
global $gCms;
if (! isset($params['url']))
{
return;
}
else
{
$url = $params['url'];
}
if (isset($params['width']))
{
$width= $params['width'];
}
else
{
$width = 0;
}
if (isset($params['height']))
{
$height= $params['height'];
}
else
{
$height = 0;
}
if (isset($params['text']))
{
$text = $params['text'];
}
else
{
$text = "Click here";
}
// Insert script into output stream.
echo '
xMax)
{
w = xMax;
}
if (h yMax)
{
h = yMax;
}
// Center on screen.
var x = screen.availWidth / 2 - w / 2;
var y = screen.availHeight / 2 - h / 2;
var options = "";
options += "toolbar=no, location=no, directories=no, status=yes, ";
options += "menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, ";
options += "dependent=yes, ";
options += "width=" + w + ", height=" + h + ", left=" + x + ", top=" + y;
var popupWindow = window.open(url, "PopUp", options);
}
// -->
';
// Insert anchor tag into output stream.
echo "$text";