usman07 Posted May 15, 2012 Author Share Posted May 15, 2012 Yeah sure heres the link: http://www.mumtazproperties.hostei.com/map.html Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345620 Share on other sites More sharing options...
mrMarcus Posted May 15, 2012 Share Posted May 15, 2012 Yeah sure heres the link: http://www.mumtazproperties.hostei.com/map.html OK - you're not passing 'image' as an argument to the createMarker() function. See how you passed the others, you need to pass image as well. function createMarker(point, name, address, type, image) { var marker = new GMarker(point, customIcons[type]); var html = "<img src='" + image + "'/><span class='mapinfo'>" + name + "</span> <br/><br/>" + address; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345622 Share on other sites More sharing options...
usman07 Posted May 15, 2012 Author Share Posted May 15, 2012 it must have something to do with this area of code? How can I implement the image in there too? thanks function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(53.823708, -1.513281), 13); GDownloadUrl("phpsqlajax_genxml.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); } }); } } Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345624 Share on other sites More sharing options...
usman07 Posted May 15, 2012 Author Share Posted May 15, 2012 Iv actually got it sorted and it appears now, how do i go about styling it? thanks! Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345627 Share on other sites More sharing options...
mrMarcus Posted May 15, 2012 Share Posted May 15, 2012 Iv actually got it sorted and it appears now, how do i go about styling it? thanks! Yes, every time you add a new column you'll need to update all applicable code within the script(s). That's why I was saying this way is over-complicating the process using an external XML generator PLUS a separate XML parser. Style it like I showed you earlier. Inline within the createMarker() function. Or by using CSS classes. Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345629 Share on other sites More sharing options...
usman07 Posted May 15, 2012 Author Share Posted May 15, 2012 Yeah the problem im having now is when you click the pointer, the first image comes out of the window, then unclick it and click it again, it then stretches. why does it do this, have a look here on this link please: http://www.mumtazproperties.hostei.com/map.html and click the yellow pointer, thanks Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345631 Share on other sites More sharing options...
mrMarcus Posted May 15, 2012 Share Posted May 15, 2012 Yeah the problem im having now is when you click the pointer, the first image comes out of the window, then unclick it and click it again, it then stretches. why does it do this, have a look here on this link please: http://www.mumtazproperties.hostei.com/map.html and click the yellow pointer, thanks Works fine for me. The image is contained within the infowindow. Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345638 Share on other sites More sharing options...
usman07 Posted May 15, 2012 Author Share Posted May 15, 2012 The image sticks out of the info window then when I select it again, the info window then stretches? What browser are you using? Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345641 Share on other sites More sharing options...
usman07 Posted May 15, 2012 Author Share Posted May 15, 2012 The first click showing you in the image below: Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345645 Share on other sites More sharing options...
mrMarcus Posted May 15, 2012 Share Posted May 15, 2012 Always have a width and height declared for an image. You can do so using css, or to be 100% compatible across the board, use in the inline width/height attributes as some versions of IE will not render the image at all without them. function createMarker(point, name, address, type, image) { var marker = new GMarker(point, customIcons[type]); var html = "<img src='" + image + "' width='100' height='75' align='left'/><span class='mapinfo'>" + name + "</span> <br/><br/>" + address; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } Use that block of code. Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345646 Share on other sites More sharing options...
usman07 Posted May 15, 2012 Author Share Posted May 15, 2012 Thats brilliant mate, thats works, the only problem I have now is when I click the yellow pointer, the window info moves and points elsewhere away from where the pointer is. Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345649 Share on other sites More sharing options...
usman07 Posted May 15, 2012 Author Share Posted May 15, 2012 ignore the above post, I got it sorted, thanks so much for all your help! Hugely appreciate it! Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345650 Share on other sites More sharing options...
Drummin Posted May 15, 2012 Share Posted May 15, 2012 You're going to want to move this body tag out of the table. Have this one with the onload properties replace your regular <body> tag. <tr> <th><div id="key"><img src="cutouts/maps/key.jpg" alt=""/></div></th> <body onload="load()" onunload="GUnload()"> <th><div id="map" style="width: 780px; height: 480px"></div></th> </tr> Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1345653 Share on other sites More sharing options...
Drummin Posted May 16, 2012 Share Posted May 16, 2012 I see you still have body tag within <tr> tag. <body onload="load()" onunload="GUnload()"> Fix this. Quote Link to comment https://forums.phpfreaks.com/topic/262524-how-could-i-style-the-echo/page/2/#findComment-1346031 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.