pmeswani Posted April 4, 2007 Posted April 4, 2007 Hi, I am trying to paste the following <!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?file=api&v=2&key=xyz" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(1,2); } } //]]> </script> </head> <body onload="load()" onunload="GUnload()"> <div id="map" style="width: 500px; height: 300px"></div> </body> </html> onto our about_us.php page and have hit a stumbling block. Any suggestions on how to get this to work would be much appreciated.
Iniquityclothing Posted April 4, 2007 Posted April 4, 2007 is just to display a map of were you are? View recent 'helpfull' threads: 403 Error problems | Ultimate SEO (contribution support)
xdam Posted April 4, 2007 Posted April 4, 2007 I can't see where your map id is defined in the coding at the top? Perhaps you have abit of code missing i'd retrace my steps to see if I left anything out.
Iniquityclothing Posted April 4, 2007 Posted April 4, 2007 youre trying to load an entire page into your document, is this what you need? View recent 'helpfull' threads: 403 Error problems | Ultimate SEO (contribution support)
pmeswani Posted April 4, 2007 Author Posted April 4, 2007 is just to display a map of were you are? Yep.
pmeswani Posted April 4, 2007 Author Posted April 4, 2007 I can't see where your map id is defined in the coding at the top? Perhaps you have abit of code missing i'd retrace my steps to see if I left anything out. I removed it from the html, not sure if I should be posting it. I also removed the co-ordinates as well. I know that the code works as a standard html code, but am looking to integrate it into a php code. I have copied all the <script> </script> code into the header.php file and the body content into the about_us.php file. Am not sure if I am missing something obvious.
pmeswani Posted April 4, 2007 Author Posted April 4, 2007 youre trying to load an entire page into your document, is this what you need? Yes. Getting it to work as an independant HTML document is fine. However, I would like to keep the design consistant as much as possible. I know it's not difficult, but not being a php programmer, I am finding it difficult to translate html into php code. I have a workaround in place (linking to the html page), but would be happy to have a more permanent solution. I don't think it would do much harm by including the API key... so here is the code in full.. <!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?file=api&v=2&key=ABQIAAAAUvtMmKEgKxRDEjF8mQ1hQhRKKj97NGctfoOZ1ipFCDM4okfhKBQTws-9MX3rssKyt4xmxNQFAjwbxw" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(50.919458,-1.288083), 15); } } //]]> </script> </head> <body onload="load()" onunload="GUnload()"> <div id="map" style="width: 1000px; height: 600px"></div> </body> </html> Any suggestion would be much appreciated.
Jack_mcs Posted April 4, 2007 Posted April 4, 2007 Hi, I am trying to paste the following <!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?file=api&v=2&key=xyz" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(1,2); } } //]]> </script> </head> <body onload="load()" onunload="GUnload()"> <div id="map" style="width: 500px; height: 300px"></div> </body> </html> onto our about_us.php page and have hit a stumbling block. Any suggestions on how to get this to work would be much appreciated. You should paste the entire code into the file. Take a look at the Easy Map contribution to see how to add it in. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
pmeswani Posted April 5, 2007 Author Posted April 5, 2007 You should paste the entire code into the file. Take a look at the Easy Map contribution to see how to add it in. Jack Thanks Jack. I'll have a look at the Easy map and see how it's done. :)
pmeswani Posted April 5, 2007 Author Posted April 5, 2007 You should paste the entire code into the file. Take a look at the Easy Map contribution to see how to add it in. Jack I've used the Easy Map code and made the necessary modifications, however the map is not displaying at all. The map can be viewed at: http://www.grangeaquatics.co.uk/easymap.php And the code is <?php /* $Id: easymap.php,v 1.1 2005/12/31 by Jack_mcs osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_EASYMAP); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_EASYMAP)); $action = (isset($_POST['action']) ? $_POST['action'] : ''); $line = array(); $line = explode(",", EM_LINES_COORD); if (tep_not_null($action)) { $longitude = $_POST['longitude']; $lattitude = $_POST['lattitude']; } else { $longitude = EM_LONGITUDE; $lattitude = EM_LATTITUDE; } ?> <!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" xmlns:v="urn:schemas-microsoft-com:vml" <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body onload="load()" onunload="GUnload()" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="columnLeft" width="<?php echo COLUMN_LEFT_WIDTH; ?>" valign="top"><table border="0" width="<?php echo COLUMN_LEFT_WIDTH; ?>" cellspacing="0" cellpadding="0"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td><td background="images/links/shadow_column_left.gif"> </td> <td><?php echo tep_draw_separator('pixel_trans.gif', COLUMN_SPACER_WIDTH, '1'); ?></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo TEXT_INFORMATION; ?></td> </tr> <?php if (EM_SHOW_MAP_LINES == 'true') { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_DRIVING_DIRECTIONS; ?></td> </tr> <?php } ?> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <!-- Start map code //--> <tr> <td> <!-- BOC googlemap //--> <style type="text/css"> v\:* { behavior:url(#default#VML); } </style> <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAUvtMmKEgKxRDEjF8mQ1hQhRKKj97NGctfoOZ1ipFCDM4okfhKBQTws-9MX3rssKyt4xmxNQFAjwbxw" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(<?php echo $lattitude; ?>, <?php echo $longitude; ?>), 14); <?php if (EM_SHOW_MAP_SIZE == 'true') { if (EM_SHOW_MAP_CONTROLS == 'complete') { ?> map.addControl(new GLargeMapControl()); <?php } ?> <?php if (EM_SHOW_MAP_CONTROLS == 'compact') { ?> map.addControl(new GSmallMapControl()); <?php } } ?> <?php if (EM_SHOW_MAP_VIEW == 'true') { ?> map.addControl(new GMapTypeControl()); <?php } ?> // map.addControl(new GOverviewMapControl()); <?php if (EM_SHOW_MAP_VIEW == 'true') { ?> map.addControl(new GScaleControl()); <?php } ?> <?php if (EM_SHOW_MAP_COORDINATES == 'true') { ?> GEvent.addListener(map, "moveend", function() { var center = map.getCenter(); document.getElementById("message").innerHTML = center.toString(); }); <?php } ?> // Our info window content var infoTabs = [ new GInfoWindowTab("<?php echo EM_LOCATION_BUBBLE_TITLE; ?>", "<?php echo EM_LOCATION_BUBBLE_CONTENT; ?>") <?php if (EM_SHOW_MAP_TAB == 'true') { ?>, new GInfoWindowTab("<?php echo EM_LOCATION_TAB_TITLE; ?>", "<?php echo EM_LOCATION_TAB_CONTENT; ?>") <?php } ?> ]; <?php if (EM_SHOW_MAP_MARKER == 'true') { ?> // Place a marker in the center of the map and open the info window // automatically var marker = new GMarker(map.getCenter()); map.addOverlay(marker); <?php if (EM_LOCATION_MAP_BUBBLE == 'true') { ?> marker.openInfoWindowTabsHtml(infoTabs); GEvent.addListener(marker, "click", function() { marker.openInfoWindowTabsHtml(infoTabs); }); <?php } } ?> <?php if (EM_SHOW_MAP_LINES == 'true') { ?> var bounds = map.getBounds(); var southWest = bounds.getSouthWest(); var northEast = bounds.getNorthEast(); var lngSpan = northEast.lng() - southWest.lng(); var latSpan = northEast.lat() - southWest.lat(); // Add a polyline with five random points. Sort the points by // longitude so that the line does not intersect itself. var points = []; points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[0]; ?>, southWest.lng() + lngSpan * <?php echo $line[1]; ?>)); points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[2]; ?>, southWest.lng() + lngSpan * <?php echo $line[3]; ?>)); points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[4]; ?>, southWest.lng() + lngSpan * <?php echo $line[5]; ?>)); points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[6]; ?>, southWest.lng() + lngSpan * <?php echo $line[7]; ?>)); points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[8]; ?>, southWest.lng() + lngSpan * <?php echo $line[9]; ?>)); points.sort(function(p1, p2) { return p1.lng() - p2.lng(); }); map.addOverlay(new GPolyline(points)); <?php } ?> } } //]]> </script> <!-- EOC googlemap //--> <div id="map" style="width: 500px; height: 400px; border: .2em; border-style: ridge; "></div> <div id="message"></div> </td> </tr> <!-- BEGIN FORM --> <tr> <td align="right"><?php echo tep_draw_form('seotips', tep_href_link(FILENAME_EASYMAP, '', 'NONSSL'), 'post', 'onSubmit="return true;" onReset="return true"') . tep_draw_hidden_field('action', 'process'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td> </tr> <tr> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '20'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '20'); ?></td> </tr> </form> <!-- END FORM --> <!-- End Map code //--> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> <td class="columnRight"><?php echo tep_draw_separator('pixel_trans.gif', COLUMN_SPACER_WIDTH, '1'); ?></td> <td > </td> <!-- body_text_eof //--> <td width="<?php echo COLUMN_RIGHT_WIDTH; ?>" valign="top"><table border="0" width="<?php echo COLUMN_RIGHT_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Any suggestions would be welcomed. Thanks again.
Jack_mcs Posted April 5, 2007 Posted April 5, 2007 See if the map appears without your modifications. If it does, it is something in those changes. If it doesn't, you are missing some required code or option. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
pmeswani Posted April 5, 2007 Author Posted April 5, 2007 See if the map appears without your modifications. If it does, it is something in those changes. If it doesn't, you are missing some required code or option. Jack The only modifications made is the key (in the php file) and the co-ordinates (in the registry). Nothing else has been modified as far as I know. I know the co-ordinates and the key are right as it works http://www.grangeaquatics.co.uk/map.html.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.