Skip to content
solidsnake edited this page Dec 21, 2010 · 12 revisions

Welcome to the Kohana-Google-Maps-Module wiki!

Here you can read about the Google Maps module. I hope you'll find the examples here helpfull! Customizing-controls

Creating a Google-Map in your action

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 = new Gmap();
   } // function

Creating more advanced Google-Maps

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, you'll overwrite it.

   public function action_index()
   {
      $map = new Gmap();
      $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);
      $this->template->gmap = $map;
   } // 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 = new Gmap();

      $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);

      $this->template->gmap = $map;
   } // function
Clone this wiki locally