-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Google Maps Markers Class
World Wide Web Server edited this page Jul 4, 2012
·
13 revisions
Category:Contributions | Category:Contributions::Libraries | Category:Contributions::Libraries::Google Maps
The Google Maps Markers Class is a simple class made so that anyone not proficient enough in javascript and the new Google Maps V3.1 API can have access to maps and place markers.
As this is a complex issue, I have put up a demo page with help and code download which you can find : here.
All you really need to do to make this class work is to provide an array of markers and call the generation function.
Here is an example controller to it's simplest expression: [code] $this->load->library('google_maps_markers'); // load the class
$this->google_maps_markers->initialize(); // initialize the class
$markers = array ( // provide some markers with appropriate information
"1" => array ( "image" => "image1",
"title" => "Montréal",
"lat" => 45.503154706,
"lng" => -73.570461273,
"contentString" => "<h1>Montréal</h1>The town I was borned in" ),
"2" => array ( "image" => "image2",
"title" => "Longueuil",
"lat" => 45.52023646,
"lng" => -73.4884071,
"contentString" => "<h1>Longueuil</h1>The town I spent most of my childhood" ),
"3" => array ( "image" => "image3",
"title" => "Lévis",
"lat" => 46.8204396,
"lng" => -71.160678,
"contentString" => "<h1>Lévis</h1>The town where I got tired of towns" ),
"4" => array ( "image" => "image4",
"title" => "Deschaillons-sur-Saint-Laurent",
"lat" => 46.55728843,
"lng" => -72.1136784,
"contentString" => "<h1>Deschaillons-sur-Saint-Laurent</h1>The town I decided to escape other towns in" ),
"5" => array ( "image" => "image5",
"title" => "Home",
"lat" => 46.55413079,
"lng" => -72.12170362,
"contentString" => "<h1>Home</h1>Where Google Maps Markers Class was written" ),
"6" => array ( "image" => "image6",
"title" => "Trois-Rivières",
"lat" => 46.3504665,
"lng" => -72.5832366,
"contentString" => "<h1>Trois-Rivières</h1>The town I need to go to if I want to see store chains" ),
);
$data['google_maps_markers'] = $this->google_maps_markers->create_map($markers);
$this->load->vars($data); // load vars data
$this->load->view('container_google_maps_markers'); // load the view
[/code]