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

FARRA, te agradezco mucho tu interes, pero no soy muy experto en esto del PHP, asi que tus notas del AJAX están a años luz de mis conocimientos, espero poder ponerme algun dia a tu nivel.

ITALICO76, lo que pretendo es precisamente eso, se trata de mostrar mapas y cada usuario puede solicitar una zona diferente.

GATORV, he intentado seguir tus notas y me han hecho adelantar mucho en el trabajo, qunque en el tema de los arreglos / array / tablas, me he quedado justito, si alquien puede darle un vistazo .....



Código PHP:
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>Google Maps JavaScript API Example</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"));

<?php
    $NomFile 
"tracks/080302AA.TRK";
    
$lines file($NomFile);
    
$nl ;
    
$puntos = array();
    
    foreach (
$lines as $line_num => $line) {
        
$datos explode(" "$line);
        If (
$datos[0] == 'z'){
            
$Long 111111;
            
$Lati 222222;

            echo 
"map.setCenter(new GLatLng(".$Lati "," .$Long " ),11);";
            echo 
"map.addControl(new GLargeMapControl());"
            echo 
"map.addControl(new GMapTypeControl());"
            echo 
"var opciones_poligono = {geodesic:true};";
        } 

        If (
$datos[0] == 'T'){
            
$Lati 3333333;
            
$Long 4444444;
            
$puntos[$nl] = array( $Lati$Long );  
            
$nl $nl+1;
        }
     }
?>
         var puntos = [];


         <?php
             
foreach( $points as $point ) {
                 echo 
"puntos.push( new GLatLng($point[0], $point[1]) );\n";
             }
          
?>

           var polyline = new GPolyline(puntos);
        
            map.addOverlay(polyline);
    }
}

window.onload=load
    //]]>
    </script>
  </head>
<?

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

Con esta rutina .

Código PHP:
If ($datos[0] == 'T'){
    
$Lati 3333333;
    
$Long 4444444;
    
$puntos[$nl] = array( $Lati$Long );  
    
$nl $nl+1;

Crearia la tabla, naturalmente aqui se estan repitiendo los mismos valores en cada uno de los arrays. (Este lo tengo claro, aunque los datos sean ficticios)


Es aqui .....

Código PHP:
         var puntos = []; 


         <?php 
             
foreach( $points as $point ) { 
                 echo 
"puntos.push( new GLatLng($point[0], $point[1]) );\n"
             } 
          
?> 

           var polyline = new GPolyline(puntos);
Donde no lo acabo de entender.

Saludos.