【发布时间】:2014-05-27 12:24:24
【问题描述】:
我正在尝试使用 Drupal 7 中的这些钩子制作自定义页面模板,但是当我在浏览器中打开时它显示空白页面。这是我的代码
/*
Implements hook_menu();
*/
function story_menu ()
{
$items['story/filters'] = array(
'title' => 'Search For stories',
'page callback' => 'story_filter_page',
'access arguments' => array('access content'),
);
return $items;
}
// Implements Page Callback
function story_filter_page ()
{
return theme('story_search_filter_page', array('title' => 'Testing'));
}
/*
Implements hook_theme();
*/
function story_theme($existing, $type, $theme, $path)
{
return array(
'story_search_filter_page' => array(
'variables' => array('title' => NULL),
'template' => 'custom-page',
),
);
}
我已经在我的模块目录中创建了模板文件:custom-page.tpl.php。
【问题讨论】:
-
这似乎是对的。可以分享一下日志吗?
-
从哪里可以找到日志?
-
<site_url>/admin/reports/dblog -
你清除了菜单缓存对吗?
-
日志为空。是的,我已经多次清除缓存。还有其他方法可以调试吗?
标签: templates drupal drupal-7 hook-menu hook-theme