0

I am using PHP and MySQL to show my all events photos and videos. I want the event date will show with the marker and after click on the marker all photos and videos will show. I can show photos and videos, but I cant show the date with the marker.

So please help.

function load() {
    if (GBrowserIsCompatible()) {

        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(xx.xxxxxx, xx.xxxxxx), 8);
        -----------------------------------------------------
        -----------------------------------------------------
        var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
            var marker = createMarker(point, name, address, type, photo);   
            map.addOverlay(marker);
    }
}

function createMarker(point, name, address, type, photo) {
    var marker = new GMarker(point, customIcons[type]);
    var html = "<h1 style='text-align: center;'>" + name + "</h1> <br/>" + photo;
    GEvent.addListener(marker, 'click', function() {
        marker.openInfoWindowHtml(html);
    });
    return marker;
}
duncan
  • 31,401
  • 13
  • 78
  • 99
  • 1
    Yikes, this is Google Maps API v2, which is very outdated, and should be written to use API v3. See https://developers.google.com/maps/articles/v2tov3 – duncan Sep 21 '16 at 14:12

1 Answers1

0

From this Google documentation example, you can see that you can put a label to each marker with a single alphabetical character.

var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var labelIndex = 0;

You can also check this SO post which might help.

There's a good label class here, though you'll have to add it alongside the markers.

Basically, you can use ELabel which allows you to place text labels or images or any other HTML elements on the map and have them move with the map, like marker and polyline overlays.

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59