I'm using Drupal 7 and have created a custom module named fb
. In the fb.module
file, I have the following:
function fb_theme($existing, $type, $theme, $path) {
return array(
'fb' => array(
'template' => 'fb'
)
);
}
In the same directory as the module file (the module's root), I have a file named fb.tpl.php
that contains:
fb.tpl.php is working!
For testing purposes, my theme's html.tpl.php
file calls the following in the body:
<?php
$ouput = theme('fb');
print_r($output);
?>
However, the print_r($output)
line doesn't produce anything. I expect it to contain the contents of the fb.tpl.php
file, or perhaps an array that contains the contents of that file as the value to one of its parameters. Why doesn't it?
You don't need to use the theme function at all in Drupal 7. Instead, create a renderable array like this:
$output = array(
'#theme' => 'fb'
);
And output it like this:
drupal_render($output);
That would be the easiest way to output it in your html.tpl.php file.