Moodle - how to add pages/items in navigation bar

LeRoy picture LeRoy · Oct 25, 2013 · Viewed 10.7k times · Source

Hey I just started using moodle and the first problem is: how to I add pages e.g. About us , Contact us.

Do I have too add it manually? Where do I have too change any settings? I tried looking for "Create web page" but I did not find anything.

I am using version 2.2.

Answer

franzlorenzon picture franzlorenzon · Oct 29, 2013

Yes, you should make them manually, it's not as straightforward as in other CMS like Wordpress.

First, you have to create some php files that includes the common parts of a Moodle web page.

As an example, create a file named about.php and place it in the root of your Moodle installation (the php code is taken from the tutorial cited above and slightly adapted):

<?php

require_once('config.php');

$PAGE->set_context(get_system_context());
$PAGE->set_pagelayout('standard');
$PAGE->set_title("About page");
$PAGE->set_heading("About");
$PAGE->set_url($CFG->wwwroot . '/about.php');


echo $OUTPUT->header();

// Actual content goes here
echo "Hello World";

echo $OUTPUT->footer();

?>

If you have your Moodle at http://moodle-example.org, your about page would be located at http://moodle-example.org/about.php.

If you'd like to, you can create a custom menu inserting the path of your newly created page.

Go to Site administration » Appearance » Themes » Theme settings. On the Custom menu items field, insert:

About us|http://moodle-example.org/about.php

Save and you'll see a menu containing a link to your newly created page.