[英]Using template file in custom module drupal 7
I have created custom module in drupal 7. I have big html to print , that's why I want to create template file 我在drupal 7中创建了自定义模块。我要打印大html,这就是为什么我要创建模板文件的原因
my module code is here 我的模块代码在这里
function test_block_view($block_name = '') {
$block['subject'] = t('test');
$block['content'] = "";
return $block;
}
function test_theme($existing, $type, $theme, $path){
return array(
'test' => array(
'variables' => array('content' => "FOO"),
'template' => 'test',
)
);
my file structure is here 我的文件结构在这里
but this code not working 但是这段代码不起作用
Can anybody help me and tell why it does not print anything? 谁能帮助我,告诉我为什么它什么都不打印?
我看不到您在哪里使用了主题功能,可以尝试在块体中渲染主题功能
$block['content'] = theme('test');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.