i 'm trying to add a file to end of body via template.php in mytheme_preprocess_page. this is the line i have:

drupal_add_js(drupal_get_path('theme', 'mytheme') . '/js/file.js',array('type' => 'file','scope' => 'footer'));

why i can't see file.js in view source? -if i change footer scope to header file.js add to head tag -

doc says:

Possible values are 'header' or 'footer'. If your theme implements different regions, you can also use these

i tried to add footer region to page.tpl.php but it doesn't work.

what do means footer scope?

  • 3
    Are you printing $page_top, $page, $page_bottom in html.tpl.php? I think in D7 'footer' falls under $page_bottom in html.tpl.php, but I could be wrong. Commented Apr 5, 2013 at 15:14
  • thank you. you are right. i was missing $page_bottom. i find this drupal.org/update/themes/6/7#closure now. if you add answer i will accept your answer :) Commented Apr 5, 2013 at 15:28

1 Answer 1


Make sure you're printing $page_bottom in html.tpl.php.

In Drupal 6, it looked like this:

<?php print $closure; ?>

In Drupal 7, you now want all 3 of the $page_top, $page, and $page_bottom variables which correlate to the header, content, and footer scopes. Here's a sample (and simple) html.tpl.php:

  <?php print $page_top; ?>
  <?php print $page; ?>
  <?php print $page_bottom; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.