搞了一天的drupal自定义模板,终于有点眉目了,赶紧记录下来,以免时间长了忘记了。
以下内容都是写在module文件中的
首先,要定义个hook_theme
[php]
function user_age_theme(){
return array(
'myprofile' => array(
'arguments' => array('uid'=>1),
'template' => 'myprofile',
),
);
}
[/php]
如上,89 'template' => 'myprofile',就可以使用自己的myprofile.tpl.php文件了。
问题来了,profile.tpl.php里面有变量,变量哪里来呢?请看下面。