Allowing Local Formatting Routines

Allowing Local Formatting Routines

بواسطة - Mike Churchward
عدد الردود: 2
صورة Core developers صورة Plugin developers صورة 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

متوسط التقييمات: -
رداً على Mike Churchward

Re: Allowing Local Formatting Routines

بواسطة - Martin Dougiamas
صورة Core developers صورة Documentation writers صورة Moodle HQ صورة Particularly helpful Moodlers صورة Plugin developers صورة Testers
Templates templates templates templates templates. And classes. Moodle 2.0.  غمزة 
رداً على Martin Dougiamas

Re: Allowing Local Formatting Routines

بواسطة - Mike Churchward
صورة Core developers صورة Plugin developers صورة 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