I have a google map api key .. AdfadXXXXXXXXXXX....
I have installed EGamp extension . how can i set Api key in below code for localhost and production.
I tried using $gMap->setAPIKey('local.mylocal.com','MYAPYKEY');
function of EGmap but not working ..
Still in console it displaying that "Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys".
Below is my code.
Yii::import('vendor.2amigos.egmap.*');
$gMap = new EGMap();
$gMap->zoom = 16;
$gMap->mapTypeControl = false;
$gMap->scrollwheel = false;
$gMap->setContainerStyle('width', '100%');
$gMap->setContainerStyle('height', '250px');
$gMap->setCenter($defaultVenue->lat, $defaultVenue->lng);
// Create GMapInfoWindows
$infoWindow = new EGMapInfoWindow('<div>' . nl2br($defaultVenue->full_address) . '</div>');
// Create marker
$marker = new EGMapMarker($defaultVenue->lat, $defaultVenue->lng, ['title' => $defaultVenue->full_address]);
$marker->addHtmlInfoWindow($infoWindow);
$gMap->addMarker($marker);
Can i use same key for local host and production ?
Was using this extension a couple of months ago. Not sure if i was missing something when reading the documentation, but what i did was hacked it a bit to get it to work. In your EGMap.php change the code to this ...
In your view, don't forget to add
$gMap->setAPIKey(DOMAIN, APIKEY)
before your$gMap->renderMap();
Hope that works