Welcome Guest, Not a member yet? Register   Sign In
Google Maps on View Files
#1

[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>
#2

[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.
#3

[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.
#4

[eluser]miss_amylee[/eluser]
ShoeLace1291..

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




Theme © iAndrew 2016 - Forum software by © MyBB