|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
dloader Smarty n00b
Joined: 19 Feb 2014 Posts: 1
|
Posted: Wed Feb 19, 2014 4:15 pm Post subject: Putting values fom db in google js tpl |
|
|
Hi there,
I'am absolutely new to smarty and run into a problem with a project.
Iám building a joomla site with a component that's working with smarty
template.
The google map is a important part of the site, and when a user is logged in and opens the map i want the map to open and center based on the geolocation of the user.
The coordinates from every user is strored in the database i have captured that during the register proces.
The point is the map.tpl have include a javascript _maps_tpl i'am having problems to get the values in it i wrote to functions to retrieve the x and y coorinates.
public function getUserCoordinatesX()
{
$my = JFactory::getUser();
$db = JFactory::getDBO();
$queryx = "SELECT cb_googlex FROM #__comprofiler WHERE user_id =$my->id";
$db->setQuery($queryx);
$corResultx = $db->loadResult();
}
public function getUserCoordinatesY()
{
$my = JFactory::getUser();
$db = JFactory::getDBO();
$queryy = "SELECT cb_googley FROM #__comprofiler WHERE user_id =$my->id";
$db->setQuery($queryy);
$corResulty = $db->loadResult();
}
And this a part of the javascript.tpl
{import_js_file url="http://maps.googleapis.com/maps/api/js?key=`$cfg->google_key`&sensor=false"}
{* oms.min.js https://github.com/jawj/OverlappingMarkerSpiderfier *}
{import_js_file url="oms.min.js"}
{import_js_block}
var zoom = {$cfg->googlemap_default_zoom|default:"12"};
var oms;
var map;
var infoWindow;
var markersArray = [];
var gmap_width = {$cfg->googlemap_gx|default:250}
var gmap_height = {$cfg->googlemap_gy|default:80}
{if ($googleMapX && $googleMapY)}
var pointTox={$googleMap_X};
var pointToy={$googleMap_Y};
{else}
var pointTox={$cfg->googlemap_defx|default:52.13095909247831};
var pointToy={$cfg->googlemap_defy|default:5.0173187255859375};
{/if}
I have tried to pull the functions in but they give errors.
Anyone suggestions thanks in avanced. |
|
Back to top |
|
|
|
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
|