hello ,

Iam trying to add google map fuctionality in website dynamicallly. Iam sucessfull in but noe i want my map to be opened in lightbox .i have googled and found various results but of no use .any kind of help appreciated

thanks

Recommended Answers

All 9 Replies

post ur code of google map then only i could find a way to integrate with lightbox......

Member Avatar for diafol

There are a million and one lightboxes out there. WHich one are you using?
On a general note, you may need to tweak z-indexes to get objects like gmaps to display correctly. As all this is heavy-js, ensure that you have a fallback for those without js enabled (not always the user's choice - e.g. school/works machines)

here is my php pahe which displays map and i want it to open in lghtbox

<?php

$intId =$_GET['id'];

$strSQL = "select * from listing where property_id='$intId'";
    $db->query($strSQL);
    if ($db->next_record())
    {
        $property_id=$db->f("property_id");
        $propertycategory=$db->f("property_category");
        $propertyprcie=$db->f("propertyprcie");
        $sellingpricevalue=$db->f("sellingpricevalue");
        $country=$db->f("country");
        $state=$db->f("state");
        $city =$db->f("city");
        $Locality=$db->f("locality");
        $address1=$db->f("address1");
        $address2=$db->f("address2");
        $prop_owner_ship=$db->f("prop_owner_ship");
        $area=$db->f("area");
        $areameasure=$db->f("areameasure");
        $built_area=$db->f("built_area");
        $name=$db->f("name");
        $phone=$db->f("phone");
        $mobile=$db->f("mobile");
        $email=$db->f("email");

    }



$geo="http://maps.google.com/maps/api/geocode/json?address=";
$oldVariable = $city.$Locality.$address1;
$newVariable = str_replace(" ", "+", $oldVariable);

$geo1="$newVariable";
$geo2="&sensor=false";
$georesult=$geo.$geo1.$geo2;
$geocode=file_get_contents($georesult);
$output= json_decode($geocode);
$latitude = $output->results[0]->geometry->location->lat;
$longitude = $output->results[0]->geometry->location->lng;



?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAA2HiaO5V9J0IggpugOcOvHhQJEZxcpa-IbEAJkz0rxReRY1wzrBR8aBcUaQlCUJXMkg8MKo26dxih4A" type="text/javascript"></script>


</head>

<body>
<div id="map" style="width: 600px; height:500px"></div>

<script type="text/javascript">
var map = new GMap(document.getElementById("map"));
var point = new GPoint(<?php echo $longitude; ?>,<?php echo $latitude; ?>);
var address = "<?php echo $oldVariable; ?>";
var mark = createInfoMarker(point, address);
map.addOverlay(mark);
function createInfoMarker(point, address) {
 var marker = new GMarker(point);
 map.centerAndZoom(point, 3);

 GEvent.addListener(marker, "mouseover",
 function() {[CODE][/CODE]
 marker.openInfoWindowHtml(address);
 }
 );
 return marker;
}
</script>

</body>
</html>
<?php

$intId =$_GET['id'];

$strSQL = "select * from listing where property_id='$intId'";
    $db->query($strSQL);
    if ($db->next_record())
    {
        $property_id=$db->f("property_id");
        $propertycategory=$db->f("property_category");
        $propertyprcie=$db->f("propertyprcie");
        $sellingpricevalue=$db->f("sellingpricevalue");
        $country=$db->f("country");
        $state=$db->f("state");
        $city =$db->f("city");
        $Locality=$db->f("locality");
        $address1=$db->f("address1");
        $address2=$db->f("address2");
        $prop_owner_ship=$db->f("prop_owner_ship");
        $area=$db->f("area");
        $areameasure=$db->f("areameasure");
        $built_area=$db->f("built_area");
        $name=$db->f("name");
        $phone=$db->f("phone");
        $mobile=$db->f("mobile");
        $email=$db->f("email");

    }



$geo="http://maps.google.com/maps/api/geocode/json?address=";
$oldVariable = $city.$Locality.$address1;
$newVariable = str_replace(" ", "+", $oldVariable);

$geo1="$newVariable";
$geo2="&sensor=false";
$georesult=$geo.$geo1.$geo2;
$geocode=file_get_contents($georesult);
$output= json_decode($geocode);
$latitude = $output->results[0]->geometry->location->lat;
$longitude = $output->results[0]->geometry->location->lng;



?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAA2HiaO5V9J0IggpugOcOvHhQJEZxcpa-IbEAJkz0rxReRY1wzrBR8aBcUaQlCUJXMkg8MKo26dxih4A" type="text/javascript"></script>


</head>

<body>
<div id="map" style="width: 600px; height:500px"></div>

<script type="text/javascript">
var map = new GMap(document.getElementById("map"));
var point = new GPoint(<?php echo $longitude; ?>,<?php echo $latitude; ?>);
var address = "<?php echo $oldVariable; ?>";
var mark = createInfoMarker(point, address);
map.addOverlay(mark);
function createInfoMarker(point, address) {
 var marker = new GMarker(point);
 map.centerAndZoom(point, 3);

 GEvent.addListener(marker, "mouseover",
 function() {
 marker.openInfoWindowHtml(address);
 }
 );
 return marker;
}
</script>

</body>
</html>

here is my php page which displays map

Member Avatar for diafol

Use code tags [ CODE ]

Member Avatar for diafol

I think this may well be a question for the js forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.