Moodle - how to add pages/items in navigation bar

11,506

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.

Share:
11,506
LeRoy
Author by

LeRoy

For the past 5 years, I've been developing applications for the mobile using mostly ionic. I do this for a living and love what I do as every day there is something new and exciting to learn. In my spare time, the mobile development community is a big part of my life. Whether managing online programming groups and blogs or attending a conference, I find keeping involved helps me stay up to date. This is also my chance to give back to the community that helped me get started, a place I am proud to be part of. Besides programming I love spending time with friends and family and can often be found together going out catching the latest movie, staying in playing games on the sofa or planning a trip to someplace I've never been before. My job involves doing what I love, Developing new websites/applications, customer relationship management (CRM) applications and developing fantastic content management systems (CMS). I spend a lot of time learning new techniques and actively help other people learn mobile development through a variety of help groups .

Updated on June 04, 2022

Comments

  • LeRoy
    LeRoy almost 2 years

    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.

  • Nishant
    Nishant over 8 years
    Awesome answer @franzlorenzon. But problem is that http://moodle-example.org/about.php is accessible only for logged-in users. Anonymous users not able to access this. How to do this so that anonymous user can also access this url.
  • franzlorenzon
    franzlorenzon over 8 years
    @NishantPandya I think that's a moodle configuration issue. Go to: Settings → Site administration → Security → Site policies. On that page, disable “Force users to login”.
  • franzlorenzon
    franzlorenzon over 8 years
    @Pacerier what theme are you using? Not everyone supports the feature. Have a look at the docs.
  • Pacerier
    Pacerier over 8 years
    @franzlorenzon, It's an older version. $version = 2007101524. There's no "custom menu items" here. What are the options for older version?