Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/03/2008, 17:10
Pinyo22
 
Fecha de Ingreso: mayo-2006
Mensajes: 59
Antigüedad: 18 años
Puntos: 0
PHP y JAVASCRIPT

Estoy trabajando con Google map y quisiera integrar variables de PHP con JAVASCRIP y no tengo ni idea, ni de como se hace ni donde exponer el problema, asi es que me he decidido hacerlo en este foro que es con el que estoy mas familiarizado.


Las variables creadas con php serian:


$Latitud = 11111;
$Longitud = 22222;


$Latitud01 = 33333;
$Latitud02 = 55555;
$Latitudnn = nnnnn;
......
$Latitud99 = 77777;

$Longitud01 = 44444;
$Longitud02 = 66666;
$Longitudnn = nnnnn;
......
$Longitud99 = 88888;


Con las variables numeradas intento indicar que no sabemos de cuantos valores podremos disponer.


Asi en el programa quedaria como sigue ......

Código PHP:
<!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>Programa de pruebas</title>
    <
script 
src
="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAAUYitxn0dTgDCq4jyCOwyBRedSTuckIKFb12qs9LHoiSCPxwXxRY8X1Vhyidf4QUkYLe_1EOCMMFbg"
      
type="text/javascript"></script>

    <script type="text/javascript">
    //<![CDATA[
function load() {
        if (GBrowserIsCompatible()) {
                var map = new GMap2(document.getElementById("map"));
                map.setCenter(new GLatLng(11111,22222),11);

                var opciones_poligono = {geodesic:true};

                var V001 = new GLatLng(33333, 44444);
                var V002 = new GLatLng(55555, 66666);
                var Vnnn = new GLatLng(nnnnn, nnnnn);
                var V999 = new GLatLng(77777, 88888);

                var polyline = new GPolyline([V001,V002, Vnnn, ....  , V999]);
                map.addOverlay(polyline);
        }
}

window.onload=load
    //]]>
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 800px; height: 600px"></div>
  </body>
</html> 

Ni que decir tiene que la linea
var polyline = new GPolyline([V001,V002, Vnnn, .... , V999]);
tendria que reducirse al maximo, (una tabla?????) ya que el numero de parametros puede ser muy alto.

De entrada gracias por leerlo.