-
Notifications
You must be signed in to change notification settings - Fork 9
Home
solidsnake edited this page Feb 12, 2011
·
12 revisions
Here you can read about the Google Maps module. I hope you'll find the examples here helpfull!
So, you want to display a Google-Map on your Homepage or in your Kohana application. You can just echo an instance of the Gmap class... Simple, is it?
public function action_index()
{
$this->template->gmap = Gmap::factory();
} // function
Inside your view:
<h2>Look, a Google Map!</h2>
<?php echo $gmap; ?>
So, you want to add a few markers? That's no problem - Keep in mind that the "marker-id" (first parameter) must always be unique. If not, your previous marker will be overwritten.
public function action_index()
{
$map = Gmap::factory();
$this->template->bind('gmap', $map);
$map->add_marker('A brand new marker', 51.123, 6.987)
->add_marker('Another marker', 52.13, 6.87);
->add_marker('A third marker', 52.34, 6.23);
} // function
But simply displaying markers is a bit boring - So we'll add some Content and maybe a custom icon?
public function action_index()
{
$map = Gmap::factory();
$this->template->bind('gmap', $map);
$marker_options = array(
'content' => '<p>Simply stuff some <b>HTML</b> here!</p>',
'icon' => Kohana::find_file('path/to/image', 'image');
);
$map->add_marker('A brand new marker', 51.123, 6.987, $marker_options)
->add_marker('Another marker', 52.13, 6.87);
} // function