1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
<?php
require('GoogleMapAPI.class.php');
$map = new GoogleMapAPI('map','test');
$map->setAPIKey('Ma clé');
//taille de la map
$map->setHeight("600"); //hauteur
$map->setWidth("700"); //largeur
//réglages divers, voir la doc de la classe
$map->disableTypeControls();
$map->setMapType('map'); // default
$map->disableDirections();
$map->enableZoomEncompass();
$map->enableOverviewControl();
$infos_resto = "";
$res=$DB->Query("SELECT.... ); // ma requete
while ($row = mysql_fetch_array($res)) {
if($row['longitude'] != "" && $row['lattitude']){
$map->addMarkerByCoords($row['longitude'], $row['lattitude '],"bonjour");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>title</title>
<link rel="stylesheet" type="text/css" href="googleMap.css">
<style>
v:* {
behavior:url(#default#VML);
} /*pour les infobulles de la carte*/
#gmapmarker {
font: normal small verdana, arial, helvetica, sans-serif;
font-size: 10pt;
margin: 0px;
width: 400px;
height: 80px;
overflow:auto;
}
#gmapmarker p{
margin : 0;
padding : 2px 0 2px 0;
}
#gmapmarker a {
text-decoration: none;
color: #0066CC;
background-color: transparent;
}
#gmapmarker a:hover {
color: #F60;
background-color: transparent;
}
#gmapmarker h1 {
font-weight: bold;
font-size: 13px;
color: #369;
border-bottom: 2px solid #369;
padding : 2px;
margin : 0;
}
</style>
<?php
$map->printHeaderJS();
$map->printMapJS();
//charge les fonctions JS nécessaires dans le HEAD
?>
</head>
<body style="background-color:#FFF; margin:0px" onload="onLoad()">
<table border="1" width="700" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php $map->printMap(); ?>
//affiche la carte
</td>
</tr>
<tr>
<td class="normal">
<?php $map->printSidebar(); ?>
// ça, c'est si tu veux une zone sous la carte qui reprend toutes les adresses.
</td>
</tr>
</table>
</body>
</html> |