Allowing Local Formatting Routines

Allowing Local Formatting Routines

by Mike Churchward -
Number of replies: 2
Picture of Core developers Picture of Plugin developers Picture of Testers

Id like to be able to change some key display screens in Moodle. This involves changing and adding significant code to standard Moodle release files. The problem with that is I also want to be able to stay up to date with the new Moodle releases and changing these functions will make that difficult.

As an example, I would like to change the way the category and topic index pages display, using side boxes. This involves changing the course/lib.php, course/index.php and course/category.php files as a minimum.

The problem is that these changes are not likely desired by anyone else, and therefore really cant be part of the main release, and I dont want to fork.

So, can we implement a method that would allow local display routines to be added that would not impact the main Moodle release? As a suggestion, we could add checks for files with "local-" prefixes and include them if present. This could be added to the main release of Moodle without affecting its function, and would allow updates to be done with minor impact on local changes.

As an example, I would add the following lines to course/lib.php, probably after the define statements:
    if (file_exists("$CFG->dirroot/course/local-lib.php")) {
        include_once("$CFG->dirroot/course/local-lib.php");
    }


The local- file would have all of the local changes Ive added, and would not impact the main release.

Thoughts? Is there already a way to do this that I've missed?

mike

Average of ratings: -
In reply to Mike Churchward

Re: Allowing Local Formatting Routines

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Templates templates templates templates templates. And classes. Moodle 2.0.  wink 
In reply to Martin Dougiamas

Re: Allowing Local Formatting Routines

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

This is a good thing. I support (and will support) those moves (templates and classes, that is)!

For now, I'll add my own "local-" files, and update as necessary when I update Moodle.

mike