views:

37

answers:

3

I have a Drupal module creating a page via hook_menu(). I am trying to make it so the page has no extraneous html output, only what I want. You can view the page here, http://www.thomashansen.me/chat/thomas. If you look at the source, you can see a strange script tag at the end.

My page-chat.tpl.php looks like this,

<?php
// $Id$
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
<head>
</head>
<body>
<?php print $content; ?>
</body>
</html>

Where is that script tag coming from? and how do I get rid of it? If you need more information just ask.

A: 

If you're talking about this:

<script type="text/javascript" src="/sites/all/modules/google_analytics/googleanalytics.js?n"></script> 
<script type="text/javascript"> 
<!--//--><![CDATA[//><!--
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
//--><!]]>
</script> 
<script type="text/javascript"> 
<!--//--><![CDATA[//><!--
try{var pageTracker = _gat._getTracker("UA-15854642-1");pageTracker._trackPageview("/403.html?page=" + document.location.pathname + document.location.search + "&from=" + document.referrer);} catch(err) {}
//--><!]]>
</script>

It's Google Analytics code that is being added by the Google Analytics module. You can disable the module to remove the code.

HaleFx
No I'm talking about the script which comes up on the end of www.thomashansen.me/chat/thomasit looks like "</html><script type="text/javascript">jQuery.extend(Drupal.settings, { "thmr_5": { "name": "theme_menu_item_link", "type": "func", "duration": 0.51, "used": "theme_menu_item_link", "candidates": [ "scaccarium_menu_item_link", "phptemplate_menu_item_link", ...."
Thomas4019
That looks like you've got the Theme Developer module enabled. Switch that off and have another look.
lazysoundsystem
Thanks that was it.
Thomas4019
A: 

Sorry, the page required permission to view. Anyway the script is now gone. Maybe just time fixed it.

Thomas4019
A: 

What you mention in the comment comes from the devel_themer (part of the devel module) module. It's extending the global Drupal js varaible.

Drupal creates a global Drupal js variable, that holds different info. Modules and themes can use it to create some variables with info from Drupal, that they need, like API keys or variables to determine how the script should behave.

devel_themer is posting info about the different portions of the output to a script variable. That's how it makes it possible for you to inspect your markup and see which theme functions or templates was used to generate the output, and how to overwrite it. It creates a lot of span tags, and display that info you saw in the script, depending on which one you hover over with your mouse.

googletorp
Thanks that was it. Turned it off and it's great!
Thomas4019