multiple flags with labels from an array

1 post / 0 new
digerati
multiple flags with labels from an array

I'm trying to show a leaflet map with a few markers (shown as flags), and each flag should have a different label on it (like the address or a number). I have the flag labels in a php array, but I can't figure out how to add them to the flags.
Here's the code I've got... currently all the flags say "A".

 

        window.onload = function() {
    L.mapquest.key = 'key here';
    // Geocode three locations, then call the createMap callback
    L.mapquest.geocoding().geocode([<?=$address?>], createMap);
    function createMap(error, response) {
    // Initialize the Map
    var map = L.mapquest.map('map', {
    layers: L.mapquest.tileLayer('map'),
    center: [0, 0],
    zoom: 12
    });
    // Generate the feature group containing markers from the geocoded locations
    var featureGroup = generateMarkersFeatureGroup(response);
    featureGroup.addTo(map);
    map.fitBounds(featureGroup.getBounds());
    }
    function generateMarkersFeatureGroup(response) {
    var group = [];
    for (var i = 0; i < response.results.length; i++) {
        var location = response.results[i].locations[0];
        var locationLatLng = location.latLng;
        // Create a marker for each location
        var marker = L.marker(locationLatLng, {icon:     L.mapquest.icons.marker({
    primaryColor: '#22407F',
    secondaryColor: '#3B5998',
    shadow: true,
    size: 'md',
    symbol: 'A'    })})
    .bindPopup('<?=$row['address1']?><br/><a href="property-detail.php?id=    <?=$row['id']?>">See details</a>')
    .openPopup();
        

    group.push(marker);
    }
    return L.featureGroup(group);
    }
    }