【发布时间】:2013-02-24 11:48:49
【问题描述】:
我有一个大约 100 个地址的小地址数据库。所以现在我添加了来自 https://github.com/marcferna/CakePHP-GoogleMapHelper 的 Helpper。
我知道如何将地址添加到视图中。但是如何将所有地址添加到一张地图中?
大家可以帮帮我吗?
在此先感谢
马库斯
【问题讨论】:
标签: google-maps cakephp view helper cakephp-2.3
我有一个大约 100 个地址的小地址数据库。所以现在我添加了来自 https://github.com/marcferna/CakePHP-GoogleMapHelper 的 Helpper。
我知道如何将地址添加到视图中。但是如何将所有地址添加到一张地图中?
大家可以帮帮我吗?
在此先感谢
马库斯
【问题讨论】:
标签: google-maps cakephp view helper cakephp-2.3
为什么要加逗号?
<?php $this->GoogleMap->addMarker("map_canvas",1, $atla['Atla']['street'].' '.$atla['Atla']['number'].', '.$atla['Atla']['zipcode'].' '.$atla['Atla']['city'],$atla['Atla']['name'])?> <?php endforeach; ?>
应该是
<?php $this->GoogleMap->addMarker("map_canvas",1, $atla['Atla']['street'].' '.$atla['Atla']['number'].', '.$atla['Atla']['zipcode'].' '.$atla['Atla']['city'].','.$atla['Atla']['name'])?> <?php endforeach; ?>
但是:http://www.dereuromark.de/2010/12/21/googlemapsv3-cakephp-helper/ 怎么样? 它可能是一个更完整的选择。
据记载,您可以使用
$this->GoogleMapV3->addMarker($options);
任意多次。我尝试了 500 并且 - 尽管此时您可能想要切换到集群 - 它仍然有效。
【讨论】:
The Problem is that now i get an error 'extract() expects parameter 1 to be array, string given 这是我的 foreach <?php foreach ($atlas as $atla): ?> <?php $this->GoogleMap->addMarker("map_canvas",1, $atla['Atla']['street'].' '.$atla['Atla']['number'].', '.$atla['Atla']['zipcode'].' '.$atla['Atla']['city'],$atla['Atla']['name'])?> <?php endforeach; ?>
<?php $this->GoogleMap->addMarker("map_canvas",1, array($atla['Atla']['street'].' '.$atla['Atla']['number'].', '.$atla['Atla']['zipcode'].' '.$atla['Atla']['city']),"testing")?> 添加应该看起来像这样 $this->GoogleMap->addMarker("map_canvas",1,"Neckarstraße 150A, 70190 Stuttgart", $marker_options)