Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Please check the examples on google maps utilities library page (<a href="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/docs/examples.html" rel="nofollow">link</a>).</p> <p>But basically to add instance of an object (a marker) to an array you have to define the array first so you need to do the <code>var markers = [];</code> above the loop where you create the markers. And then as you create the markers you have to add them to the markers array by calling the <code>push</code> method of an array (while you are at it go to MDN and read about arrays! if you want to learn it's good time to start there - there is a tutorial about JS there as well (<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array" rel="nofollow">link</a>).</p> <p>So inside of the <code>foreach</code> loop afer you've defined a marker just add it to the array <code>markers.push(marker);</code> This will make the markers available for the <code>MarkerCluster</code> initialization.</p> <p>In a longer term when you figure out javascript a bit better you'll probably want to replace this part with either passing data as JSON object to the DOM so methods can handle it or even better - have the data for markers be retrieved with ajax query. But one step at a time I guess :)</p> <p>Maybe try the fun interactive tutorials at the <a href="http://www.codecademy.com/" rel="nofollow">www.codecademy.com</a>? They are quite basic but seems like that's exactly what you need </p> <p>EDIT:</p> <pre><code>var marker, markers = []; &lt;?php foreach ($cluster_location as $location) { ?&gt; marker = new google.maps.Marker({'position': &lt;?php echo $location;?&gt;}); markers.push(marker); &lt;? } ?&gt; </code></pre>
    singulars
    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.
 

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