cyandi_man Posted January 26, 2009 Share Posted January 26, 2009 Hi guys - I have a comapany listing page which the user can do a search for companies by city in the gta, ontario canada. The thing is how do i imlement the following code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/ <title>Google Maps JavaScript API Example</title> <script src="http://maps.google.com/maps? mykey goes here &sensor=true" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(43.5658865,-79.7006233), 15); // (up/ down- lower=down, left/right-lower is left), larger for zoom) >-79.5921458,43.5494699 var marker = new GMarker(new GLatLng(43.5658865,-79.7006233)); map.addOverlay(marker); } } //]]> </script> </head> <body onload="load()" onunload="GUnload()"> <div id="map" style="width:400px;height:250px"></div> </body> </html> INTO my page that dynamically pulls all the locations from a database? i actually entered this code into the database field called "Map" changing only the co-ordinates for each location -- however only the first business lisiting has the map pop up. I know it has to be because this code is starting and terminating with head, body and html tags. what is the correct way of doing this? (i am new to coding - forgive me!) Quote Link to comment https://forums.phpfreaks.com/topic/142478-how-do-i-implement-google-maps-into-my-loop/ Share on other sites More sharing options...
MatthewJ Posted January 26, 2009 Share Posted January 26, 2009 There is quite a bit more to it than feeding it the coords in a loop... Look at this example, you should be able to extract some useful info out of it. http://code.google.com/apis/maps/articles/phpsqlsearch.html Quote Link to comment https://forums.phpfreaks.com/topic/142478-how-do-i-implement-google-maps-into-my-loop/#findComment-746544 Share on other sites More sharing options...
MatthewJ Posted January 26, 2009 Share Posted January 26, 2009 After thinking about this again for a few minutes... You could do what you're trying to do by echoing out the value of the coords field in the db with each map. But you would need to at least try and code it a bit on your own... What you have posted here is a copy and paste of a demo map from google where you have hard coded in the coords. All you would really need to do is echo the coords field in place of the hard coded coords in your map. Quote Link to comment https://forums.phpfreaks.com/topic/142478-how-do-i-implement-google-maps-into-my-loop/#findComment-746704 Share on other sites More sharing options...
cyandi_man Posted January 29, 2009 Author Share Posted January 29, 2009 After thinking about this again for a few minutes... You could do what you're trying to do by echoing out the value of the coords field in the db with each map. But you would need to at least try and code it a bit on your own... What you have posted here is a copy and paste of a demo map from google where you have hard coded in the coords. All you would really need to do is echo the coords field in place of the hard coded coords in your map. Gad Zooks! thats it! thanks man! i will try that right away! Quote Link to comment https://forums.phpfreaks.com/topic/142478-how-do-i-implement-google-maps-into-my-loop/#findComment-749163 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.