我创建了一个新的drupal 7主题并试图在template.php上实现hook_theme,如下所示:
function mytheme_theme($existing, $type, $theme, $path){
return array(
'mytheme_header'=>array(
'template'=>'header',
'path'=>$path.'/templates',
'type'=>'theme',
),
);
}
Run Code Online (Sandbox Code Playgroud)
然后我将header.tpl.php放入模板目录并清除所有缓存,并调用主题函数:
theme('mytheme_header', $vars);
Run Code Online (Sandbox Code Playgroud)
和header.tpl.php赞了这个:
<?php
fb('calling header template');//the function of FirePHP to output debug info
print '<div>Header</div>';
//...
Run Code Online (Sandbox Code Playgroud)
我检查Firebug,它获取信息'调用标题模板',这意味着它已调用header.tpl.php,但它没有打印html代码.我的代码出了什么问题?