How to implement hook_theme in drupal 7?
- by solomon_wzs
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);
but it did not work and render page with header.tpl.php. What's wrong with my code?