2014-05-15 8 views
0

Je viens de tester l'API goi go à codeigniter mais avec une erreur que je n'ai pas comprise. Gravité: Avis Message: Undefined variable: carteCodeigniter Google maps api

le code est d'ici

http://biostall.com/demos/google-maps-v3-api-codeigniter-library/

+0

Etes-vous sûr que vous chargez la bibliothèque "de googlemaps"? – lesssugar

+0

classe carte étend CI_Controller { fonction index \t() { \t \t \t $ this-> load-> Bibliothèque (GoogleMaps); \t \t $ config ['center'] = '35 .825795, 10.607212 '; \t \t $ config ['zoom'] = 'auto'; \t \t $ config ['directions'] = VRAI; \t \t $ config ['directionsStart'] = 'Sousse chemin de fer'; \t \t $ config ['directionsEnd'] = 'Sousse Sud'; \t \t $ config ['directionsDivID'] = 'directionsDiv'; \t \t $ this-> googlemaps-> initialize ($ config); \t \t $ data ['map'] = $ this-> googlemaps-> create_map(); \t \t $ this-> load-> view ('maps', $ data); \t} } – user3616893

Répondre

0
if (isset($_GET["w1"]) && isset($_GET["w2"])) 
{ 
    $config['center'] = $lat = $_GET["w1"].','.$lng = $_GET["w2"]; 
    $marker = array();   
    $marker['position'] = $lat = $_GET["w1"].','.$lng = $_GET["w2"]; 
    $latlng = $_GET["w1"].','.$_GET["w2"]; 
    $request = file_get_contents('https://maps.googleapis.com/maps/api/geocode/json?address=.$latlng.&key=AIzaSyAOAR94QMB9YdE8RXHG-8NE28cz6wdUw2I'); 
    $json = json_decode($request, true);            
    $marker['infowindow_content'] = implode("|", $json); 
    $this->googlemaps->add_marker($marker);    
}