Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

How I create google map in smarty

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
gsbaghel
Smarty n00b


Joined: 23 Apr 2008
Posts: 1

PostPosted: Wed Apr 23, 2008 8:22 am    Post subject: How I create google map in smarty Reply with quote

Hi ,
I have two pages....
1.abc.php and another is abc.tpl.
i have include class file in abc.php
abc.php page code here....

include("GoogleMapAPI.class.php");
$map = new GoogleMapAPI('map');
$map->setAPIKey('key');
$main_smarty->assign('google_map_header',$map->getHeaderJS());
$main_smarty->assign('google_map_js',$map->getMapJS());
$geocode = $map->geoGetCoords('237 S 70th suite 220 Lincoln NE 68510');
echo $geocode['lon'];
echo "<br>" ;
echo $lon;
echo $geocode['lat'];
$map->addMarkerByCoords($geocode['lon'],$geocode['lat'],'test','test');


$main_smarty->assign('google_onload',$map->printMap());
$main_smarty->assign('google_map',$map->getMap());

in abc.tpl page code .......

{literal}
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
{/literal}
<body onLoad="onLoad()">
<table width="800" border=0 align="center">
<tr><td>
</tr>
<tr>

<td colspan=2>{$google_map}</td>
{$google_onload}
</tr>
</table>
</body>
But MAP is not showing.............???
Back to top
View user's profile Send private message
Olin
Smarty n00b


Joined: 23 Oct 2008
Posts: 4

PostPosted: Thu Oct 23, 2008 5:17 pm    Post subject: Reply with quote

im trying too , help Sad
Back to top
View user's profile Send private message
viswa
Smarty n00b


Joined: 11 May 2010
Posts: 1

PostPosted: Tue May 11, 2010 11:43 am    Post subject: use this ... Reply with quote

save as phpfilename.php

<?php
include "header.php";
$page="test_map";
require('GoogleMapAPI.class.php');
$map = new GoogleMapAPI('mymap','myapp');
// setup database for geocode caching
$map->setDSN('mysql://geo:foobar@localhost/social_engine');
// enter YOUR Google Map Key
$map->setAPIKey('ABQIAAAAxp5FF-A0RhHOnnTBwrlRbx');
// create some map markers
$map->addMarkerByAddress('621 N 48th St # 6 Lincoln NE 68502','PJ Pizza','<b>PJ Pizza</b>');
$map->addMarkerByAddress('826 P St Lincoln NE 68502','Old Chicago','<b>Old Chicago</b>');
$map->addMarkerByAddress('3457 Holdrege St Lincoln NE 68502',"Valentino's","<b>Valentino's</b>");
$smarty->assign('map_header',$map->getHeaderJS());
$smarty->assign('map_head',$map->printHeaderJS());
$smarty->assign('map_js',$map->getMapJS());
$smarty->assign('map_mapjs',$map->printMapJS());
$smarty->assign('map_getmap',$map->getMap());
$smarty->assign('map_map',$map->printMap());
$smarty->assign('map_side',$map->printSidebar());
include 'footer.php';
?>

save as
test_map.tpl in template folder


{include file='header.tpl'}
{$map_head}
{$map_mapjs}
<!-- necessary for google maps polyline drawing in IE -->

<body onload="onLoad()">
<table border=1>
<tr><td>{$map_map}</td>
<td>{$map_side}</td>
</tr>
</table>
</body>
{include file='footer.tpl'}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP