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

Google Map possible if you can't call JS between <head>

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


Joined: 12 Mar 2010
Posts: 1

PostPosted: Fri Mar 12, 2010 3:41 pm    Post subject: Google Map possible if you can't call JS between <head> Reply with quote

Greetings,

Because of the way my CMS is set up, I am not able to insert the JS between the <head> tags because the dynamic values of my addresses don't get loaded until later in the page. So in order to make this work, I need to load my JS later and what I have done is this:

Code:

<body>
<?php
<!-- MUCH OTHER CODE -->
// Pull in Google Maps class file
    require_once('/home/foo/public_html/wp-content/themes/foo-home/assets/php/GoogleMapAPI.class.php');
    $map = new GoogleMapAPI('map1');
    $map->disableOnLoad();
    //$map->setDSNgoog('mysql://foo:bar@localhost/foo_geocodes');
    $map->setAPIKey('foo');

           $map->addMarkerByAddress('621 N 48th St # 6 Lincoln NE 68502','PJ Pizza','<b>PJ Pizza</b>');
           $map->printHeaderJS();
            $map->printMapJS();
           $map->printMap();
            $map->printOnLoad();
?>
<!-- OTHER CODE -->
</body>


But all that happens is I get a space for the map in my layout but no map. Can someone advise what I'm doing wrong or even if this is possible?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7365
Location: Lincoln Nebraska, USA

PostPosted: Fri Mar 12, 2010 3:50 pm    Post subject: Reply with quote

1) check the browser source, see that you are getting exactly the HTML/JS output you are expecting.
2) check javascript console for errors
3) spot check javascript, make sure vars have values you expect.

It's not always simple to pinpoint. Check file system paths, if you have any. That is the usual suspect.
Back to top
View user's profile Send private message Visit poster's website
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