簡體   English   中英

使用hook_menu的Drupal 7自定義模板

[英]Drupal 7 Custom Template Using hook_menu

我正在嘗試使用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。

我已經弄清楚了為什么頁面顯示空白。 基本上,故事是我的內容類型,所以在我的主題中有一個tpl文件名: page--story.tpl.php ,該文件為空..這就是為什么我的頁面顯示空白屏幕的原因。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM