How to implement google map in smarty?

Hi friends ,

the following script will discuss for how to implement google map in smarty application.

1) Sign up for API key of googlemap

http://code.google.com/apis/maps/signup.html

2) Create a google map class.

Googlemap implementation in smarty - Anil kumar panigrahi

Googlemap implementation in smarty - Anil Labs

 

3) Create a tpl file, and add below code :

{php}

$key="Your API Key";
$gm = & new EasyGoogleMap($key);
$gm->SetMarkerIconStyle('STAR');
$gm->SetMapZoom(10);

$city ="baruva";
$country = "india";
$gm->SetAddress($city,$country);
$gm->SetInfoWindowText("This is address .");

$gm->SetInfoWindowText("Anil Labs - http://www.anillabs.com");
echo $gm->GmapsKey();
echo $gm->MapHolder();
echo $gm->InitJs();
echo $gm->GetSideClick();
echo $gm->UnloadMap();

{/php}

Anil Kumar Panigrahi

With more than 10 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online ... Contact : [email protected]

You may also like...

6 Responses

  1. Ipsita says:

    Hi,
    I know the Google Translate API and done a small application.
    I need smarty plugin for Google Translate API to change the content of my application into the selected language .
    As like there is plug in for Google Map, Google Analytic ; like that I need Google Translate in smarty.
    Can u please help me

  2. @Ipsita: I developed small plugin in codeigniter using google translate API. Once check it and it will be useful.

  3. zulaa says:

    hi dear, i’m no used for google map in smarty because
    Fatal error: Class ‘EasyGoogleMap’ not found in … , help me.

  4. Sonu says:

    Hi,I am getting error “Fatal error: Uncaught exception ‘SmartyException’ with message ‘{php} is deprecated, set allow_php_tag = true to enable’ ”

    Please help me how to solve this.Thanks!

  1. March 9, 2012

    […] links developed in smartyHow to implement google map in smarty?How to integrate fckeditor in smarty […]

Leave a Reply

Your email address will not be published. Required fields are marked *