Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
- class Roadmap extends CI_Controller {
- function __construct() {
- parent::__construct();
- $this->load->library('googlemaps');
- $this->load->model('M_map');
- }
- function index() {
- // Initialize the map, passing through any parameters
- $config['center'] = '106.7018137,-6.1358678';
- $config['zoom'] = "auto";
- $this->googlemaps->initialize($config);
- // Get the co-ordinates from the database using our model
- $coords = $this->M_map->get_coordinates();
- // Loop through the coordinates we obtained above and add them to the map
- foreach ($coords as $coordinate) {
- $marker = array();
- $marker['position'] = $coordinate->LAT.','.$coordinate->LNG;
- $this->googlemaps->add_marker($marker);
- }
- // Create the map
- $data = array();
- $data['map'] = $this->googlemaps->create_map();
- print_r($data['map']['markers']);
- //$this->template->display('map/roadmap', $data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment