How to implement hook_theme in drupal 7?
Posted
by
solomon_wzs
on Stack Overflow
See other posts from Stack Overflow
or by solomon_wzs
Published on 2012-10-20T05:53:42Z
Indexed on
2012/10/20
11:01 UTC
Read the original article
Hit count: 181
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?
© Stack Overflow or respective owner