Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 12th, 2013  |  syntax: None  |  size: 1.27 KB  |  views: 469  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.it/maps?q=<?php echo $yourAddress; ?>&output=embed"></iframe>
  2.        
  3. <head>
  4. ...
  5. <script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
  6. <script>
  7.   var geocoder;
  8.   var map;
  9.   function initialize() {
  10.     geocoder = new google.maps.Geocoder();
  11.  
  12.     var mapOptions = {
  13.       zoom: 12, //Change the Zoom level to suit your needs
  14.       mapTypeId: google.maps.MapTypeId.ROADMAP
  15.     }
  16.     //map_canvas is just a <div> on the page with the id="map_canvas"
  17.     map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
  18.  
  19.     //Your Variable Containing The Address
  20.     var address = "<?php echo $AddressVariable; ?>";
  21.     geocoder.geocode( { 'address': address}, function(results, status) {
  22.       if (status == google.maps.GeocoderStatus.OK) {
  23.         map.setCenter(results[0].geometry.location);
  24.         //places a marker on every location
  25.         var marker = new google.maps.Marker({
  26.             map: map,
  27.             position: results[0].geometry.location
  28.         });
  29.       } else {
  30.         alert('Geocode was not successful for the following reason: ' + status);
  31.       }
  32.     });
  33.  
  34.   }
  35.  
  36. </script>
  37. ...
  38. </head>
  39.        
  40. <body onload="initialize()">