I can't see a google variable in the code of your OP, only
GoogleMapDiv and GoogleMap.
HTH, Paul
On Sep 26, 8:22 pm, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
> hi paul,
>
> thanks for answering. you may have a point ;)
> i use firebug and it says google undefinded, when i click the icon.
> the correct data is passed (checked that with firebug too and some
> logic too)
>
> the thing is, the actual map wont be loaded, although the data is
> passed.
>
> if i keep the logic/code as above and load the map in a separate view
> (not an element, a normal view) it works fine...the element seems to
> be the prob...this is bugging me :)
>
> On 25 Sep., 11:44, WebbedIT <p...@webbedit.co.uk> wrote:
>
>
>
>
>
>
>
> > Hi, and it appears that you tell us what is working, but fail to tell
> > us what isn't working.
>
> > Do you get any errors at all? Are you using FIreBug to see if the
> > element (which is exactly the right type of view template to be using
> > for AJAX calls) is returning the right data?
>
> > HTH, Paul.
>
> > On Sep 24, 3:03 pm, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
>
> > > 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','StructureLatitu dine');
>
> > > ?>
>
> > > 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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment