I am using a custom module (copied from a site where it is working)

The module's .info file is as follows:

name = jCarousel Rotator
description = An image rotator implementing the jCarousel jQuery plugin
package = mymodules
core = 7.x

stylesheets[all][] = css/jcarousel_rotator.css
scripts[] = js/jquery.jcarousel.min.js
scripts[] = js/jcarousel_rotator.js

But none of these files are loading. The theme I'm in is made from scratch.. is there something that needs to be added to the template.php for those include hooks to work?

I searched all the code of the old site and the files are not being explicitly loaded elsewhere.

I have been able to load the files by adding the code manually to the footer, but this is not a great way to have a module integrated.

As requested, my html.tpl.php is as follows:

<?php include 'header.php'; ?>
<?php echo $page; ?>
<?php include 'footer.php'; ?>
  • No hooks are required. They should all work provided that the files exist. Have you tried clearing your caches? If you've copied from a working site, are the two sites running the same version of Drupal?
    – Chapabu
    May 16, 2012 at 13:27
  • yep same version.. and I have cleared the cache at least 30 times
    – Damon
    May 16, 2012 at 13:41
  • It might sound silly, but is the module enabled on the second site? Sometimes I forget the simplest things. Also, is the theme on the first site built from scratch, or does it use a base theme?
    – Chapabu
    May 16, 2012 at 14:18
  • Are those lines first quoted in the MODULE's or the THEME's .info file? And where are those js/ and css/ directories located?
    – Jimajamma
    May 16, 2012 at 15:11
  • 1
    Could you paste the whole info file. Perhaps there's an error somewhere else in the doc that is causing the lines not to be read?
    – Chapabu
    May 16, 2012 at 16:18

3 Answers 3


Based on your edit including html.tpl.php, I agree with Chapa that's it very, umm, "Un-Drupaly". This is the default system rendering of html.tpl.php:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>"<?php print $rdf_namespaces; ?>>

<head profile="<?php print $grddl_profile; ?>">
  <?php print $head; ?>
  <title><?php print $head_title; ?></title>
  <?php print $styles; ?>
  <?php print $scripts; ?>
<body class="<?php print $classes; ?>" <?php print $attributes;?>>
  <div id="skip-link">
    <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a>
  <?php print $page_top; ?>
  <?php print $page; ?>
  <?php print $page_bottom; ?>

You see where it says:

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

That's where Drupal dumps your JavaScript and CSS files. If you're not making those calls chances are you're not going to get any included files. I guess to verify this you'd also have to edit in your header.php and footer.php files so we can see what they contain. This is where you want to start looking.

I recommend backing up your existing html.tpl.php file to somewhere, and then overwriting it with the system version of it, which can be found at modules/system/html.tpl.php relative to the root directory of your site on your system.

  • 1
    I'm sure Drupal-ly is a word... Maybe I shouldn't have put the hyphen in ;-)
    – Chapabu
    May 16, 2012 at 18:07
  • Add to dictionary... :) May 16, 2012 at 18:09
  • aha! well we have most of the 'drupal-y' stuff in the header and footer.. thse 2 lines of php should be exactly what I need, though. This way I can print scripts in the footer too where they more properly belong :)
    – Damon
    May 16, 2012 at 20:15
  • 3
    ps.. i think drupal-y is the adjective.. drupal-ly would be an adverb :p
    – Damon
    May 16, 2012 at 20:17
  • You sir, get an upvote :-)
    – Chapabu
    May 16, 2012 at 20:19

It will be better if you post the modulename.info file here. As it seems the code in the info file is correct.

About a proper way, If you use hooks then this is what you can do.

drupal_add_css() & drupal_add_js().

drupal_add_css(drupal_get_path('module', 'module_name') . '/style.css', array(
    'group' => CSS_DEFAULT, 
    'every_page' => TRUE,

Then you can call it in hook_init(). Hope that helps you.

  • I got bit by this too, and I got down voted for giving this exact same answer. Reason being is it isn't a solution to the problem he's specified. The solution should be such that all he needs to do is have the .js and .css files specified in his .info and they should just load on every page. They're not loading though, so the problem is elsewhere. Calls to those various API functions are used to load the files on specific pages. May 16, 2012 at 17:03

How about adding using drupal_add_css() and drupal_add_js(). In you .module you can add JS and CSS via hook_init().

Something like this:

 * Implementation of hook init
function module_name_init(){
  drupal_add_js(drupal_get_path('module', 'module_name') . '/js/module_name.js');
  drupal_add_css(drupal_get_path('module', 'module_name').'/css/module_name.css');

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.