twinytwo Posted February 22, 2012 Share Posted February 22, 2012 HI guys, On my site users are enabled to see the location of other users they are trying to find, but i want to add a link to that all users profiles on the window of their marker. Below is the code for the map. The link would be coded something like <a href="userprofile.php?id=<?php echo $row['id'];?>"> im not sure if this is or the correct approach . I would thnk that it would have to be added to the create marker function... but i can get it to work Any help would be appreciated. <script type="text/javascript"> //<![CDATA[ var iconBlue = new GIcon(); iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png'; iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'; iconBlue.iconSize = new GSize(12, 20); iconBlue.shadowSize = new GSize(22, 20); iconBlue.iconAnchor = new GPoint(6, 20); iconBlue.infoWindowAnchor = new GPoint(5, 1); var iconRed = new GIcon(); iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png'; iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'; iconRed.iconSize = new GSize(12, 20); iconRed.shadowSize = new GSize(22, 20); iconRed.iconAnchor = new GPoint(6, 20); iconRed.infoWindowAnchor = new GPoint(5, 1); var customIcons = []; customIcons["restaurant"] = iconBlue; customIcons["bar"] = iconRed; function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(51.89787, -8.47109), 13); GDownloadUrl("geo.php", function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var name = markers[i].getAttribute("name"); var address = markers[i].getAttribute("address"); var type = markers[i].getAttribute("type"); var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var marker = createMarker(point, name, address, type); map.addOverlay(marker); } }); } } function createMarker(point, name, address, type) { var marker = new GMarker(point, customIcons[type]); var html = "<b>" + name + "</b><br/>" + address; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } //]]> Link to comment https://forums.phpfreaks.com/topic/257517-adding-internal-links-to-a-google-maps-marker/ Share on other sites More sharing options...
twinytwo Posted February 22, 2012 Author Share Posted February 22, 2012 anyone? Link to comment https://forums.phpfreaks.com/topic/257517-adding-internal-links-to-a-google-maps-marker/#findComment-1319957 Share on other sites More sharing options...
twinytwo Posted February 26, 2012 Author Share Posted February 26, 2012 bumping for justice Link to comment https://forums.phpfreaks.com/topic/257517-adding-internal-links-to-a-google-maps-marker/#findComment-1321398 Share on other sites More sharing options...
requinix Posted February 26, 2012 Share Posted February 26, 2012 Yes, you need to modify createMarker(). And load() too. createMarker() needs another parameter so it can know what the URL is. It could be passed the whole URL that it uses verbatim, or just an ID number which it turns into a URL. Doesn't matter. Then load() needs to grab that information from the XML (or wherever) and pass that to createMarker(). Link to comment https://forums.phpfreaks.com/topic/257517-adding-internal-links-to-a-google-maps-marker/#findComment-1321418 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.