[support] Where to add items to the <head> section for all pages?

Richard Damon Richard at Damon-Family.org
Sat Sep 15 21:33:54 UTC 2012


On 9/15/12 5:08 PM, Dotan Cohen wrote:
> I am using this terrific template:
> http://drupal.org/project/traction
>
> I need to add a Javascript include on all pages. I have grepped about
> for "DOCTYPE html PUBLIC" but none of the files in
> ~/sites/all/themes/traction/ contains that text. The only other place
> that seemed likely was ~/modules/system/html.tpl.php but adding the
> Javascript include there did not make it appear in the page source.
> Which file contains the <head> section HTML that is included in all
> pages?
>
> Thanks!
>
modules/system/html.tpl.php  puts out the outer most html for the page
(actually, this is where the page is finally rendered, with most of the
page in variables that it prints.

THIS IS CORE, DO NOT HACK IT.

It is possible that your hacking of it did not work because someone has
overridden it (search for other html.tpl.php files)

This template (and any overrides if it is allowed to be overridden) is
supposed to get the html tags to include scripts from the $scripts
global, which it will print out. A theme is supposed to add needed
scripts with a statement in its .info file like:
scripts[] = foo.js

Note also that you will need to clear caches after making changes or
they may not appear.

A quick google search find http://drupal.org/node/1073212 which has a
discussion of a similar issue.

-- 
Richard Damon



More information about the support mailing list