hello.module
function hello_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'hello':
$items = db_test();
$block['subject'] = t('区块标题');
$block['content'] = theme('hello', array('items'=>$items));
break;
case 'cccc':
.....................................
break;
}
return $block;
}
//hook_theme
function hello_theme($variable) {
return array(
// 模板文件的写法
'hello' => array(
'variables' => array('abc'=>'fgggggggggg'),
'template' => 'hello',
),
);
}
page.tpl.php
<?php var_dump($abc); 刚学习drupal, 在page.tpl.php中输出为null, 而且hello_theme没有被程序调用,各位给指点下吧Drupal 版本