Advertisement
mrdrifter

Untitled

Apr 12th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. <?php
  2. mysql_connect('host', 'db_xxx', 'xxx') or exit("brak polaczenia mysql");
  3. mysql_select_db('db_xxx')or exit("nie moge wybrac bazy danych mysql");
  4. ?><!DOCTYPE HTML>
  5. <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
  6. <script src="js/SanMap.min.js"></script>
  7. <script>
  8. var mapType = new SanMapType(1, 2, function (zoom, x, y) {
  9. return x == -1 && y == -1 ? "tiles/map.outer.png" : "tiles/map." + zoom + "." + x + "." + y + ".png";//Where the tiles are located
  10. });
  11. var sm = new SanMap('map-canvas', {'Map': mapType}, 1);
  12.  
  13. //Place a marker in Idlewood
  14. var homeInfoWindow = new google.maps.InfoWindow({
  15. content: '<h3>I live here</h3><p><b>Home</b>, sweet home!</p>'
  16. });
  17. var homeMarker = new google.maps.Marker({
  18. position: SanMap.getLatLngFromPos(2050, -1700),
  19. map: sm.map,
  20. icon: 'icons/Icon_31.gif'
  21. });
  22. google.maps.event.addListener(homeMarker, 'click', function() {
  23. sm.map.setCenter(homeMarker.position);
  24. homeInfoWindow.open(sm.map,homeMarker);
  25. });
  26. //Uncomment to show an alert with the position when you click on the map
  27. /* google.maps.event.addListener(sm.map, 'click', function(event) {
  28. var pos = SanMap.getPosFromLatLng(event.latLng);
  29. alert(pos.x + "," + pos.y);
  30. }); */
  31. </script>
  32. </body>
  33. <div id="map-canvas"></div>
  34.  
  35.  
  36.  
  37. <?php
  38. $res=mysql_query("SELECT * FROM `Interiors`");
  39. while($row=mysql_fetch_assoc($res))
  40. {
  41. $interior=array();
  42. $interior["icon"]=$row['mapicon'];
  43. $interior["name"]="ikona";
  44. $interior["pos"]["x"]=$row['x0'];
  45. $interior["pos"]["y"]=$row['y0'];
  46. $interiors++;
  47.  
  48. echo "<script>var homeMarker = new google.maps.Marker({
  49. position: SanMap.getLatLngFromPos({$row['x0']}, {$row['y0']}),
  50. map: sm.map,
  51. icon: 'icons/Icon_31.gif'
  52. });</script>";
  53. }
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement