我刚安装了一个名为devel themer的着名Drupal模块。它适用于管理员和其他核心页面,如节点。问题是我的模块出现致命错误。
错误讯息: 致命错误:无法在第293行的/home/dev-bioshock/public_html/sites/all/modules/devel_themer/devel_themer.module中取消设置字符串偏移
我的template.php
function bioshock_theme($existing, $type, $theme, $path) {
return array(
'moon_display'=>array(
'template'=>'moon'
),
);
}
我的module.module
function moon_perm() {
return array('access apps content');
}
function moon_menu() {
$items['moon'] = array(
'title' => 'this is a test',
'description' => t('Detalle de un Programa'),
'page callback' => 'moon_page',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK
);
return $items;
}
function moon_page(){
$moonsvariable = 'hi this is a function';
return theme('moon_display',$moonsvariable);
}
我的代码中是否有错误?
答案 0 :(得分:1)
theme()的第二个参数必须是数组。请参阅示例http://drupal.org/node/933976。另请参阅Drupal 7 - How to assign a variable to a template?