Load a static custom landing page by default and link it to Moodle

Re: Load a static custom landing page by default and link it to Moodle

by Russell England -
Number of replies: 0
Picture of Plugin developers

Works well for me, thank you for the tip!

Just one little thing, the header has already been printed so I added this little bit of code


Add this to config.php

$CFG->customfrontpageinclude = 'local/plugin/index.php'; // No leading slash.

 Then in local/plugin/index.php

<?php
 
...
 
// Add this to your page setup.
if ($PAGE->state <= moodle_page::STATE_PRINTING_HEADER) {
    // If calling from the front page then it already has a header so don't print it.
    // Otherwise print as normal,
    echo $OUTPUT->header();
}
 
...
 
echo $OUTPUT->footer();
 
// Add this to the end of the page.
exit(); // This forces the frontpage to stop at this point so nothing else is printed.