'Drupal is not defined' from Drupal.extend on gmap pages, Help!

Omni - June 26, 2007 - 04:25

I recently installed the gmap module, no problems there but there is just a blank space where the map should be. Also on any page where the gmap module is used I am getting the error "Drupal is not defined", pointing to a line that calls Drupal.extend.
Any insight would be stupendous!
Thanks

api key?

jmarkantes - June 26, 2007 - 04:52

The usual issue that that is not having a google api key.
J

Thanks for the response!

Omni - June 26, 2007 - 10:27

So I might not get the usual message box saying the key isn't valid? I have a key for the base url ie. http://www.mysite.com, I also have clean URLs turned on. Some posts on here say you can't use them and others show examples where they work - is there a definative answer on this?

should definitely work

jmarkantes - June 26, 2007 - 22:37

On several sites we have clean urls turned on, and gmap works fine. Our keys are for the root of the site (base url).

The only issue I've run into was while migrating to a new server, the domain didn't match the key's domain until the dns caught up. In that case, an error message in an alert box came up.

Awesome info!

Omni - June 27, 2007 - 00:08

After your posts I'm fairly sure it's not the key thats giving me the problem. The site node is http://www.cyouthc.ca/node/37 - if you have the ability to check the JS errors you will see my problem - 'Drupal is not defined' . Anything else that this could be?

Same problem

shunting - July 5, 2007 - 01:49

I have a new API key; I'm not getting the message about having no API key; and I get the error "Drupal" is not defined.

In my case, there aren't any js files loaded AT ALL in view source, although it's a stock Drupal 5 install...

http://www.universalpantograph.com

Gaah, posting the comment...

shunting - July 5, 2007 - 02:07

... made me say Oh! It's the template...

And of course it was. I guess the flip side of enabling extra complexity is late night goofups like this!

http://www.universalpantograph.com

what theme are you using?

nogat - October 17, 2007 - 08:34

did you try changing the theme? i experimented same problem usign fern theme, that seems not include a required JS.

nogat

Location of $scripts in theme

crc5779 - January 1, 2008 - 21:56

I had this same issue, and as it turns out, it's related to how the map block loads gmap info. It's done inline, so the $scripts var has to be printed out before that block is loaded. I had moved the $scripts var to the bottom of the page to increase page load time, but then the necessary js definitions aren't available as the page is loading elements (like the location block).

Hope that helps!

My Solution

mrproper - March 13, 2008 - 13:17

Maybe you have missed your google key, try to add

<? print $scripts;

print $head; ?>

To your page.tpl.php on the head section. It works for me.

Good Luck!

I have this in the

lupus78 - March 16, 2008 - 23:34

I have this in the head:

    <?php print $head ?>
    <?php print $styles ?>
    <?php print $scripts ?>

But i still get this error (Drupal not defined). The needed JS files are not included in the HTML source!

Any idea?

Same problem with DHTML Menu

joel box - March 20, 2008 - 10:40

Hi I have the same problem Drupal is not defined. But with the dhtml-menu line.

script type="text/javascript" src="/misc/jquery.js">
script type="text/javascript" src="/misc/drupal.js">
script type="text/javascript" src="/sites/all/modules/dhtml_menu/dhtml_menu.js">
script type="text/javascript">Drupal.extend({ settings: { "dhtmlMenu": { "useEffects": 1 } } });

the solution will probably work here as well.

 
 

Drupal is a registered trademark of Dries Buytaert.