Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Google maps, aggiungere la terza opzione sulla mappa

    Su questa mappa tiro fuori l'hotel selezionato e lo mostro con un marker chiamato marker.png, poi tiro fuori anche tutti gli altri hotel e li mostro con un marker chiamato marker-blu.png

    Ora voglio far visualizzare anche i luoghi di interesse.
    Come posso fare?
    Questo e' quello che uso ora:
    codice:
    <?php
    $hotel_selezionato=$_GET['hotel'];
    include("include/config.php");
    $sql = "select hotel, comune, stelle, directory, indirizzo from hotel"; 
    $risultato = @mysql_query($sql) 
    or die("Impossibile eseguire l'interrogazione."); 
    while ($riga = mysql_fetch_array($risultato)) {
    $hotel = $riga['hotel'];
    $comune = $riga['comune'];
    $stelle = $riga['stelle'];
    $directory = $riga['directory'];
    $indirizzo = $riga['indirizzo'];
    $htmlhot=str_replace("HOTEL ","",$hotel);
    $htmlhot=str_replace("RESIDENCE ","",$htmlhot);
    $htmlhot=str_replace(" ","%20",$htmlhot);
    $nomehtml=str_replace(" ","%20",$nome);
    $mostra_posizione .="map.addOverlay(createMarker(new GLatLng($indirizzo), \"<span class=azzurrobold>$hotel</span>
    <span class=grassetto>CHIAMA E PRENOTA SUBITO:</span>
    <span class=blu_big> 081 196 81 396</span>
    
    <span class=arancio>VEDI L'HOTEL</span>\", \"$hotel\"));\n";
    }
    mysql_free_result($risultato);
    
    $sql_mappa = "select nome, indirizzo, descrizione from mappa"; 
    $risultato_mappa = @mysql_query($sql_mappa) 
    or die("Impossibile eseguire l'interrogazione della mappa"); 
    while ($riga_mappa = mysql_fetch_array($risultato_mappa)) {
    $nome = $riga_mappa['nome'];
    $indirizzo = $riga_mappa['indirizzo'];
    $descrizione = $riga_mappa['descrizione'];
    $nomehtml=str_replace(" ","%20",$nome);
    $nome_interesse="$nome";
    echo "$nome_interesse";
    echo "
    ";
    }
    mysql_free_result($risultato_mappa);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <link href="include/ischia.css" rel="stylesheet" type="text/css" />
    <title>Mappa di Ischia</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    #map {
        margin: 0em 0;
        
        
        
        width: 680px; 
        height: 35em;
    }
    body {
    	background-image: url(fig/sfondo.jpg);
    	margin-left: 0px;
    	margin-top: 0px;
    }
    </style>
    
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAvd2-iXG4Tehop_UwetfTFxTv0LK4BckzWdlHpgRl5Rn0NJm61RQ_B6w1Kj0CqgFMZbJpBlTZojrNKQ" type="text/javascript"></script>
    <script type="text/javascript">
        function showMap()
        {
            if (GBrowserIsCompatible()) {
                var map = new GMap2(document.getElementById("map"));                
                //map.addControl(new GSmallMapControl());
    			map.addControl(new GMapTypeControl());		            
                map.setCenter(new GLatLng(40.727356,13.909893), 13);
    			map.setUIToDefault();             
                var icon = [];
                function createMarker(point, description, hotel) {
                  var thisHotel = "<?=$hotel_selezionato?>";
    			   var thisNome = "<?=$nome_interesse?>";
    			  //alert ("$nome");
                  if (thisHotel==hotel){
                    icon["topix"] = new GIcon(G_DEFAULT_ICON, "fig/marker.png");
    				icon["topix"].iconSize = new GSize(26, 27);
    				icon["topix"].shadow = "";
    				icon["topix"].shadowSize = "";		
                    //alert("arancione");
                  } 
    			  else { (thisHotel!=hotel)
                    icon["topix"] = new GIcon(G_DEFAULT_ICON, "fig/marker-blu.png");
    				icon["topix"].iconSize = new GSize(17, 20);
    				icon["topix"].shadow = "";
    				icon["topix"].shadowSize = "";
                    //alert("blu");
                  }                 
    			    
                  var marker = new GMarker(point,icon["topix"]);
                  GEvent.addListener(marker, "click", function() {
                    marker.openInfoWindowHtml(description);
                  });
                  return marker;
                }
                 
    <?php echo "$mostra_posizione"; ?>
    			}
    			
        }
    </script>
    
    </head>
    
    <body onload="showMap();" onunload="GUnload()"> 
    <div id="main"> 
        
        <div id="header">    
      </div>
      <div id="content">
        <table width="800" border="0" cellspacing="0" cellpadding="0">
          <tr valign=top>
            <td width="680"><div id="map">.</div> </td>
            <td bgcolor="#FFFFFF" style="padding-left:5px">
    
              <span class="blu_big">Legenda
    
              
    
              [img]fig/marker.png[/img][img]fig/spazio.gif[/img]<span class="blu">Hotel Selezionato</span>
    
              
    
              [img]fig/marker-blu.png[/img][img]fig/spazio.gif[/img]<span class="blu">Gli altri Hotel</span></span></td>
          </tr>
        </table>   
      </div> </div> <div id="footer-wrapper"></div>
    
    
    
    </body>
    
    </html>
    Mai dire Mai

  2. #2
    up
    Mai dire Mai

  3. #3
    up
    Mai dire Mai

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.