Welcome Guest, Not a member yet? Register   Sign In
Google Map
#1

[eluser]RobertB.[/eluser]
Guys, I know this questions is old news, but I still can get it so...

Today's date 03.10.10
PHP v5.3
Codeigniter v1.7.2
GoogleMapAPI-2.5


Controller
Code:
$this->load->library('Cigooglemapapi');
$this->cigooglemapapi->setAPIKey('My localhost Key');

<head>
Code:
<?php $this->cigooglemapapi->printHeaderJS(); ?>
<?php $this->cigooglemapapi->printMapJS(); ?>

<body>
Code:
<body onload equals "onLoad()">
&lt;?php $this->cigooglemapapi->addMarkerByAddress('3457 Holdrege St Lincoln NE 68502',"Valentino's","<b>Valentino's</b>");?&gt;

<div class="desc">&lt;?php $this->cigooglemapapi->printMap(); ?&gt;</div>

What I get is the map frame with the controls but no map. Can I get some help please?

Thanks,
Robert.
#2

[eluser]RobertB.[/eluser]
This is the site just in case someone wants to take a look at it. It's not a finished site, I just started it.
www.citysniff.com
#3

[eluser]Unknown[/eluser]
thanks for the post!
#4

[eluser]RobertB.[/eluser]
SOLVED!!
#5

[eluser]nelson.wells[/eluser]
Could you post the solution? I haven't used the class (and to be honest I didn't know it existed), but I do plan on using Google Maps soon so it would be nice information to have in case I run into the same problem.
#6

[eluser]RobertB.[/eluser]
Go here to get the class Class

cigooglemapi.php
Code:
require('GoogleMapAPI.class.php');

class CiGoogleMapAPI extends GoogleMapAPI{
function CiGoogleMapAPI(){

        parent::GoogleMapAPI();
        }
}

Put both the class and the cigoogleapi.php in the application/library folder
I'm using includes so..

&lt;head&gt;
Code:
&lt;?php $this->cigooglemapapi->printHeaderJS(); ?&gt;
&lt;?php $this->cigooglemapapi->printMapJS(); ?&gt;

listing (Controller)
Code:
function __construct()
    {
        parent::Controller();
        $this->load->model('listings_model');
        $this->load->library('Cigooglemapapi');
        $this->cigooglemapapi->setAPIKey('Your API');
    }

function entry()
    {        
        $data['entry'] = $this->listings_model->getEntryDetail();
        
        $address = $data['entry']->address.' '.$data['entry']->city.' '.$data['entry']->state.' '.$data['entry']->zip;
        $business = $data['entry']->business;
        
        $this->cigooglemapapi->addMarkerByAddress($address, $business, '<strong>'.$business.'</strong>');
        
        $data['main_content'] = 'detail_view';    
        $this->load->view('templates/template', $data);


listing_view (view)
Code:
&lt;?php $this->cigooglemapapi->printMap(); ?&gt;

Let me know if this helped.




Theme © iAndrew 2016 - Forum software by © MyBB