How to include header in custom module?

How to include header in custom module?

by sudheer s -
Number of replies: 1

Hi,

How to include header, footer and left side menu in custom module.

Please help me.

 

Thanks,

Sudheer

Average of ratings: -
In reply to sudheer s

Re: How to include header in custom module?

by scott braithwaite -

Hi sudheer

 

I think I am on the right path for you here but only been using moodle for about half a year now.

 

To display your blocks or side menus in the custom module you need to firstly set your page layout as below.

$PAGE->set_pagelayout('incourse'); // incourse can become whatever you need it too

Then in your theme config file you need to set out the options for the page layout you want an example of incourse is below

 'incourse' => array(
        'file' => 'general.php',
        //'regions' => array('side-pre', 'side-post'),
       // 'defaultregion' => 'side-post',
        'regions' => array(),
        'options' => array('noblocks'=>true),
    ),

Now for displaying your footer and head make sure that you are using the require command for your config file an example is below:

require_once("../../config.php");

next you need to echo out your header and footer

echo $OUTPUT->header();

echo $OUTPUT->footer();

look at examples of other mods for where these should go

 

I hope this helps and I have understood what you wanted correctly there and have fun moodling