Open bohdan-vorona opened 9 years ago
I removed "assetManager" part from the config and things started moving (rendering map).
@janar assetManager is required for this library, isn't it?
@janar can you show me your variant of config for this lib?
Readme says to add that assets config, but I don't know is it needed. Somehow my app seems to work without it. Only added params values. Google maps JS file is added in footer without that.
Didn't do anything else than installing this library via composer and filled in originally assets config like in your code. That lead me to this error. After that I added params.php config like yours and removed assetsManager from main config- and i started to work. Hopefully I didn't forgot something to mention.
params.php :
<?php return [
'adminEmail' => 'admin@example.com',
'googleMapsApiKey' => '*******',
'googleMapsLibraries' => '3.1.18',
'googleMapsLanguage' => 'en'
];
My main.php looks like this...
http://wstaw.org/m/2015/06/21/plasma-desktopvC3343.png
Composer part:
"require": {
"2amigos/yii2-google-maps-library" : "*"
btw- using: http://www.yiiframework.com/doc-2.0/guide-tutorial-advanced-app.html
@janar Thanks a lot, I'll try this approach.
@janar Thank you again, it works in my case too.
Where to write google map js?
No JS needed to get demo working @ https://github.com/2amigos/yii2-google-maps-library#usage
I am very new to PHP yii Framework. I have installed this extension via composer. And done all the steps which are written. But Not able to view anything. Can you help me?
@shivanipatel did you register your API key here https://console.developers.google.com/?
Yes
@shivanipatel
$coord = new LatLng(['lat' => 39.720089311812094, 'lng' => 2.91165944519042]);
$map = new Map([
'center' => $coord,
'zoom' => 14,
'width'=>300,
'height'=>300,
]);
var_dump($map->display());
What var_dump says in your case?
string(33) " "
@bohdan-vorona any solution you have?
@shivanipatel unfortunately, no. Size is 33, but empty...
@bohdan-vorona Can you review my piece of code please?
@shivanipatel You should have this piece of code in your layout:
...
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
Do you have? Yii inserts JS code for displaying the map in this place.
@bohdan-vorona Yes...:) A big thanks to you... Thanks a lot.
@shivanipatel ;-)
An error after installation:
Unknown Property – yii\base\UnknownPropertyException Setting unknown property: dosamigos\google\maps\MapAsset::options
Necessary params to the array bundles (web.php) and to the file params.php was added.
composer.json:
Code: