I'm trying to get a very simple module to load a template file using drupal's hook_theme(). It's pretty much as simple as you can possibly imagine.

function sectionheader_theme ( $existing, $type, $theme, $path ) {
  return array(
    'sectionheader' => array(
      'variables' => array( 'foo' => NULL ),
      'template' => 'sectionheader',

The template is named sectionheader.tpl.php. The rest of the module is working as expected. I've cleared the Drupal cache. I've inserted a die("Debug") statement in this function, and it is being executed, but my template is simply not being called, ever. The template merely has some debug text in it so I can see that it's working, but is not visible in any view of the module.

I've done everything in every example I can find, I've even copied and pasted code directly from other modules, and this template will still not load.

I've tried renaming the template and the 'template' array value. No luck.

2 Answers 2


Try implementing hook_theme_registry_alter() in your module

function sectionheader_theme_registry_alter(&$theme_registry) {

  //register a template 
  $theme_registry['sectionheader'] = array(
    'template' => drupal_get_path('module', 'sectionheader').'/sectionheader',
    'type' => 'module',



I think you are missing path in this structure.

Have you Cleared All Cache as well?

  • I'm making sure to clear cache and completely uninstall and reinstall the module after every change, just to make sure. On a whim, I did add the path earlier: 'path' => drupal_get_path('module', 'sectionheader'), But it didn't seem to help :(
    – Jape
    Oct 25, 2011 at 18:04

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.