CodeIgniter Forums
Google Maps on View Files - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Google Maps on View Files (/showthread.php?tid=23622)



Google Maps on View Files - El Forum - 10-16-2009

[eluser]ShoeLace1291[/eluser]
I downloaded the GoogleMapAPI from the Wiki on CI. I don't get any errors at all, but when I try to display the map, nothing shows up. I use database info as parameters for the setmarkerbyaddress function.

Controller:
Code:
$this->load->library('Cigooglemapapi');
            $this->cigooglemapapi->setAPIKey('ABQIAAAANQXe8cHUlwFywQG6jhOuChT0wySnT1BJZAIfKVFDuRIipGn2kBTzWBo6WJdbB9rIsTKXc-PbNVkniQ');
            
            $query = $this->db->query("SELECT * FROM restaurant WHERE url = '".$this->uri->segment(2)."'");
            $row = $query->row();
            
                $this->cigooglemapapi->addMarkerByAddress($row->MailingAddress." ".$row->City." ".$row->State." ".$row->Zipcode, $row->restaurantName, $row->restaurantName);
            
                $data = array(
                              'map' => $this->cigooglemapapi->printMap()
                              );
                              
                    $this->load->view('restaurant_view', $data);

View File:
Code:
<div id='content_container'>
    <div id='content'>
        &lt;?php $this->cigooglemapapi->printMap(); ?&gt;
</div>



Google Maps on View Files - El Forum - 10-16-2009

[eluser]markup2go[/eluser]
Are you sure $row contains any data? You should check $query->num_rows() before continuing with $row = $query->row etc etc.

If that's not the case then check the outputted JS is correct.


Google Maps on View Files - El Forum - 10-16-2009

[eluser]ShoeLace1291[/eluser]
Yes, the info was inserted into the geocodes table. The address returned as 1811 Mae St Hummelstown PA 17036 in the table and I'm 95% sure that it's correct. It's displaying a gray box(where the map should be) and the zoom/pan tools and that's it. Is that the correct address format? I tried putting in my own address but got the same thing. The geocodes table has the lon and lat for both entries.


Google Maps on View Files - El Forum - 10-28-2009

[eluser]miss_amylee[/eluser]
ShoeLace1291..

did u find out d solution?pls post it here..i hv d same prob too..thx!