[eluser]jshultz[/eluser]
I got it working finally:
Here's the Controller:
Code:
function business($id)
{
$this->load->model('Business_model');
$this->load->model('Gallery_model');
$address = $this->Business_model->addressForMap($id); //Get result row
$config['apikey'] = 'google-api-key';
$config['center_address'] = $address->busaddress .', '. $address->buscity;
$this->googlemaps->initialize($config);
$marker = array();
// $marker['address'] = $address->busaddress .' '.$address->buscity .', '. $address->buszip;
$marker['address'] = $address->busaddress .', '. $address->buscity;
$this->googlemaps->add_marker($marker);
$data['map'] = $this->googlemaps->create_map();
$data['address'] = $address->busaddress .', '.$address->buscity;
$data['photos'] = $this->Gallery_model->get_images_from_db($id);
$data['business'] = $this->Business_model->businessQuery($id);
$data['user_id'] = $this->tank_auth->get_user_id();
$data['username'] = $this->tank_auth->get_username();
$data['page_title'] = 'Welcome To Jerome - Largest Ghost Town in America';
$data['page'] = 'business_view'; // pass the actual view to use as a parameter
$this->load->view('container',$data);
}
Here's the Model:
Code:
function addressForMap($id) {
$this->db->select('b.id, b.busaddress, b.buscity, b.buszip');
$this->db->from('business as b');
$this->db->where('b.id', $id);
$this->db->limit(1);
// add a limit
$this->db->limit(1);
// get the results.. cha-ching
$q = $this->db->get();
// any results?
if($q->num_rows() !== 1)
{
return FALSE;
}
return $q->row();
}