I created a new drupal 7 theme and trying to implement hook_theme at template.php like this:
function mytheme_theme($existing, $type, $theme, $path){
return array(
'mytheme_header'=>array(
'template'=>'header',
'path'=>$path.'/templates',
'type'=>'theme',
),
);
}
then I placed header.tpl.php into templates directory and cleared all caches, and call theme function:
theme('mytheme_header', $vars);
and header.tpl.php likes this:
<?php
fb('calling header template');//the function of FirePHP to output debug info
print '<div>Header</div>';
//...
I check Firebug and it get the info 'calling header template', it mean it had called header.tpl.php, but it didn't print the html code. What's wrong with my code?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…