douyanning3724
douyanning3724
2016-07-06 09:16
浏览 24
已采纳

主题不适用于hook_menu页面

I have created a simple module with a hook_menu

function course_list_menu() {
   $items['course-list'] = array(
    'title' => 'Example Page',
    'page callback' => 'course_list_page',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
  );
 return $items;
}

  function course_list_page() {
   print '<h1>WILL BE UP SOON </h1>';
   print '<h3>this page is getting build<h3>';
  }

As i saw in examples on youtube and some other sites, this text should come in the content region when i visit the link ( with header and footer ). But in my case it is coming in a blank page Am i missing some thing ? How can i display this content int the content region.

My current output is like http://prntscr.com/bpff9q

  • using bootstrap theme
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanming7833
    duanming7833 2016-07-06 11:59
    已采纳

    You need to return something that Drupal can work with and apply to the template files.

    Try this:

    function course_list_page() {
      return array('#markup' => '<h1>WILL BE UP SOON </h1><h3>this page is getting build<h3>');
    

    }

    点赞 评论

相关推荐