How to Create a New Course Format in Moodle

In order to alter the course display, we found it necessary to create a new course format. More information regarding what we wanted to change can be found here. The process for creating a new course format is detailed below.


To create a new course view, it is best to duplicate another view and then make your modifications. The course formats can be found at /course/format. Each directory in here is a course format. To create a new one, duplicate a directory and rename it to whatever you want. The directory should contain one to three of these files:

format.php – This file is what actually formats the page. Most editing and customization will occur here.

config.phpOPTIONAL This file contains the default block layout configuration. Default blocks are the blocks that show up for a course when it is created under this view. Note that the default block layout is only used when first creating the course, not when switching between views of an already created course. The names of the block directories are separated by commas. The blocks will be located on the left column. At the location where you want the following blocks to display on the right instead of the left, separate with a colon instead of a comma. After the single colon, continue separating the block names with commas.

ajax.phpOPTIONAL This is a config file that simply enables/disables ajax on the page. If the course format you are duplicating contains this file, there is no need to edit it.


In order to provide a nice name for your course format to show up in the settings area, we have to edit a language file.

Edit /lang/en_utf8/moodle.php and add the line

$string['format<Directory Name>'] = '<Format Name>';

where you replace <Directory Name> with the directory name of your new course format and <Format Name> with the name you want your course format to show up as in the settings area.