Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- mysql_connect('host', 'db_xxx', 'xxx') or exit("brak polaczenia mysql");
- mysql_select_db('db_xxx')or exit("nie moge wybrac bazy danych mysql");
- ?><!DOCTYPE HTML>
- <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
- <script src="js/SanMap.min.js"></script>
- <script>
- var mapType = new SanMapType(1, 2, function (zoom, x, y) {
- return x == -1 && y == -1 ? "tiles/map.outer.png" : "tiles/map." + zoom + "." + x + "." + y + ".png";//Where the tiles are located
- });
- var sm = new SanMap('map-canvas', {'Map': mapType}, 1);
- //Place a marker in Idlewood
- var homeInfoWindow = new google.maps.InfoWindow({
- content: '<h3>I live here</h3><p><b>Home</b>, sweet home!</p>'
- });
- var homeMarker = new google.maps.Marker({
- position: SanMap.getLatLngFromPos(2050, -1700),
- map: sm.map,
- icon: 'icons/Icon_31.gif'
- });
- google.maps.event.addListener(homeMarker, 'click', function() {
- sm.map.setCenter(homeMarker.position);
- homeInfoWindow.open(sm.map,homeMarker);
- });
- //Uncomment to show an alert with the position when you click on the map
- /* google.maps.event.addListener(sm.map, 'click', function(event) {
- var pos = SanMap.getPosFromLatLng(event.latLng);
- alert(pos.x + "," + pos.y);
- }); */
- </script>
- </body>
- <div id="map-canvas"></div>
- <?php
- $res=mysql_query("SELECT * FROM `Interiors`");
- while($row=mysql_fetch_assoc($res))
- {
- $interior=array();
- $interior["icon"]=$row['mapicon'];
- $interior["name"]="ikona";
- $interior["pos"]["x"]=$row['x0'];
- $interior["pos"]["y"]=$row['y0'];
- $interiors++;
- echo "<script>var homeMarker = new google.maps.Marker({
- position: SanMap.getLatLngFromPos({$row['x0']}, {$row['y0']}),
- map: sm.map,
- icon: 'icons/Icon_31.gif'
- });</script>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement