2012-11-04 28 views
3

我正在为drupal 7编写模块。模块在该块['content']内部生成块和项目列表。当我使用标准主题('item_list',array('items'=> $ items))时,所有东西都能正常工作,但是当我想要定义自己的主题时,将使用它代替item_list,从而消除块。我一直在阅读文档和各种示例,但没有任何帮助。在我的模块的文件我写道:模块中拥有自己的主题

function lastposts_thm_theme() { 
    return array(
    'lastposts_thm' => array(
    'variables' => array('items' => NULL), 
    //template file, path, .... 
    ), 
); 
} 
function theme_lastposts_thm($variables) { 
    $node = $variables['items']; 
    $build = node_view($node); 
    $output = drupal_render($build); 

    return $output; 
} 

;当我从block_view函数调用它,它不工作的主题(“lastposts_thm”,$ ......)。 我错在哪里?

+0

呼叫主题('lastposts_thm',数组('items'=> $ items)) –

+0

我知道,我这样称呼它,不起作用。 –

回答

1

检查您的主题是否打印块的变量并在主题的信息字段中定义区域。这可能是你面临的问题。 。