Search code examples
phpdrupal-7

Theme not working for hook_menu page


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

Solution

  • 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>');
    

    }