Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Display Multiple Google Maps in the page with API V3
    primarykey
    data
    text
    <p>I'm using google map API v3, and i have an issue.</p> <p>I get my coordinates from data base and i need to display them with more than one map, and i don't know the number of maps.</p> <p>Here the code php code:</p> <pre><code>&lt;div id="view-content"&gt; &lt;?php foreach ($this-&gt;tag as $tag) : ?&gt; &lt;div id="list"&gt; &lt;div id="left"&gt; &lt;div id="map_canvas" style=" margin-left: 5px; width: 136px; height: 136px;"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="right"&gt; &lt;div id="listtitre"&gt; &lt;a href="&lt;?php echo $this-&gt;url(array('action' =&gt; 'maptag', 'controller' =&gt; 'maptag', 'module' =&gt; 'agent', 'idtag' =&gt; $tag['idtag'])); ?&gt;"&gt; &lt;?php echo $tag['name']; ?&gt; &lt;/a&gt; &lt;/div&gt; &lt;div id="tagdisctitle"&gt; &lt;font&gt;Address: &lt;/font&gt;&lt;br/&gt; &lt;font&gt;Latitude: &lt;/font&gt;&lt;br/&gt; &lt;font&gt;Longitude: &lt;/font&gt;&lt;br/&gt; &lt;/div&gt; &lt;div id="taglistdisc"&gt; &lt;?php if (strlen($tag["address"]) &gt; 52) echo substr($tag["address"], 0, 52) . "..."; else echo substr($tag["address"], 0, 52) . "."; ?&gt; &lt;br/&gt; &lt;?php echo $tag['latitude']; ?&gt;&lt;br/&gt; &lt;?php echo $tag['longitude']; ?&gt;&lt;br/&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;?php endforeach; ?&gt; &lt;/div&gt; </code></pre> <p>The JS code:</p> <pre><code>function initialize() { var myOptions = { center: new google.maps.LatLng(36.6464862, 9.9565553 ), zoom: 7, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addListener(map, 'click', function(event) { placeMarker(event.latLng); }); var marker; function placeMarker(location) { if(marker){ //on vérifie si le marqueur existe marker.setPosition(location); //on change sa position }else{ marker = new google.maps.Marker({ //on créé le marqueur position: location, map: map, icon : "/images/mapgo.png" }); } latitude.value=location.lat(); longitude.value=location.lng(); } } </code></pre> <p>Thanks for any help</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload