hi everyone,

once again I need your help. I am trying to include google maps. it
works fine as long as I show one map in a view. now i retrieve several
objects from my database and I need to show a google map for each
object. this is how its supposed to work:

a user clicks on a map icon on view history.ctp, depending what object
location he wants to see (this view shows a bunch of objects). then an
element, that shows the map, toggles in a div.

all this is triggeredby clicking the map icon. i used this JS-
function, that is called when clicking the icon:



function showObjectGoogleMap(input, input_latitude, input_longitude)
{
        var googleMapDiv = '#googleMapDiv_';

        $(googleMapDiv + input).load('/mah/users/map', {'latitude':
input_latitude, 'longitude' : input_longitude}, function() {


                        $(googleMapDiv + input).slideToggle('slow', function() 
{ });
                });

}
<?php
foreach($user['History'] as $all):
..load data for each object
echo '<div id="googleMapDiv_'.$all['id'].'" style="width:400px;height:
400px;border: 1px solid blue;display:none;">
endforeach;
?>



AS you can see i pass the longitude and lat to my controller:



function map()
        {
                //debug('in map...');

                $latitude = $_POST['latitude'];
                $longitude = $_POST['longitude'];


                $default = 
array('type'=>'0','zoom'=>13,'lat'=>$latitude,'long'=>
$longitude);
        $points = array();
        $points[0]['Point'] = array('longitude' =>
$default['long'],'latitude' =>$default['lat']);

                $this->set('points', $points);
                $this->set('default', $default);


                $this->render('../elements/users/map', 'ajax');

    }



SO I take the data passed from my view and set it for the element:



views/elements/map.ctp
<?php

        $key = $this->GoogleMap->key;
        echo $javascript->link($this->GoogleMap->url);
        echo "test";
        echo $this->GoogleMap->map($default,'width: 600px; height:
400px');
        echo $this->GoogleMap->addMarkers($points);
        echo $this->GoogleMap-
>moveMarkerOnClick('StructureLongitudine','StructureLatitudine');
?>


what happnens is:
- the element is called correctly ("test" is echoed)
- longitude and latidude are passed correctly to my controller (i
checked)

so I'm guessing the problem here is, that i am going through a loop???
or maybe because i am using an element to show the map and not in a
reguilar view as before??

as always i appreciate your help :)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to