<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gb2048</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gb2048"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Gb2048"/>
	<updated>2026-04-15T07:44:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Using_the_File_API_in_Moodle_forms&amp;diff=58816</id>
		<title>Using the File API in Moodle forms</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Using_the_File_API_in_Moodle_forms&amp;diff=58816"/>
		<updated>2021-05-16T11:36:43Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: _manager should be _filemanager as per &amp;#039;file_postupdate_standard_filemanager()&amp;#039; in &amp;#039;/lib/filelib.php&amp;#039;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.0 all files are stored in a central database accessible via the [[File API|File API]], and every file is associated with a component and a &amp;quot;file area&amp;quot; in Moodle, such as a particular module.&lt;br /&gt;
&lt;br /&gt;
A common use case is to provide a form (using Moodle&#039;s [[lib/formslib.php|Forms API]]) which allows users to upload or import files as attachments or media embedded into HTML.&lt;br /&gt;
&lt;br /&gt;
Normally this works like this:&lt;br /&gt;
# User starts creation or re-edits an existing item in Moodle (eg forum post, resource, glossary entry etc)&lt;br /&gt;
# User presses some sort of button to browse for new files to attach or embed&lt;br /&gt;
# User sees our &amp;quot;Choose file...&amp;quot; dialog, which contains one or more repository instances. &lt;br /&gt;
# User chooses a file, the corresponding [[Repository plugins|Repository plugin]] takes care of copying the file into a &amp;quot;draft file area&amp;quot; within Moodle&lt;br /&gt;
# File appears in the text or as an attachment in the form.&lt;br /&gt;
# When the user hits save, the [[File API|File API]] is invoked to move the file from the draft file area into a permanent file area associated with that data &lt;br /&gt;
&lt;br /&gt;
This document shows you exactly how to use Moodle forms to interact with users in a standard and secure way.&lt;br /&gt;
&lt;br /&gt;
If you just want to write code to manipulate Moodle files internally (without user input) then see [[File API]].&lt;br /&gt;
&lt;br /&gt;
==Form elements== &lt;br /&gt;
&lt;br /&gt;
In Moodle 2.0 there are three file-related form elements for interacting with users:&lt;br /&gt;
&lt;br /&gt;
# filemanager - the way to attach one or more files as a set&lt;br /&gt;
# editor - the way to specify a textarea with a HTML editor, and all the handling of images and movies within that HTML&lt;br /&gt;
# filepicker - a way to specify one file for the case when you want to process the file and throw it away &lt;br /&gt;
&lt;br /&gt;
In Moodle 1.9 there were two other types which are now &#039;&#039;&#039;deprecated&#039;&#039;&#039; (they work, but please do not use these anymore)&lt;br /&gt;
# file - used to just allow a normal file upload from the desktop only.&lt;br /&gt;
# htmleditor - this old method of embedding a HTML editor in a textarea is not able to support repositories etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===filepicker===&lt;br /&gt;
&lt;br /&gt;
File picker (&#039;&#039;filepicker&#039;&#039;) is a direct replacement of the older &#039;&#039;file&#039;&#039; formslib element. &lt;br /&gt;
&lt;br /&gt;
It is intended for situations when you want the user to upload &#039;&#039;&#039;one&#039;&#039;&#039; file so you can process it and delete it, such as when you are importing data from a CSV file.&lt;br /&gt;
If you want a file that remains part of the Moodle storage and will reappear when you reopen the form, then you should use a filemanager instead (and restrict it to a single file, if necessary).&lt;br /&gt;
&lt;br /&gt;
==== Using the filepicker element ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$mform-&amp;gt;addElement(&#039;filepicker&#039;, &#039;userfile&#039;, get_string(&#039;file&#039;), null,&lt;br /&gt;
                   array(&#039;maxbytes&#039; =&amp;gt; $maxbytes, &#039;accepted_types&#039; =&amp;gt; &#039;*&#039;));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Obtain the chosen file ====&lt;br /&gt;
&lt;br /&gt;
To get the contents of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$content = $mform-&amp;gt;get_file_content(&#039;userfile&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get the name of the chosen file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$name = $mform-&amp;gt;get_new_filename(&#039;userfile&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save the chosen file to the server filesystem (such as to moodledata folder):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$success = $mform-&amp;gt;save_file(&#039;userfile&#039;, $fullpath, $override);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To store the chosen file in the Moodle files pool:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$storedfile = $mform-&amp;gt;save_stored_file(&#039;userfile&#039;, ...);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== filemanager ===&lt;br /&gt;
&lt;br /&gt;
The File Manager element improves on file picker by allowing you to manage more than one file.  It is expected that the files will be stored permanently for future use (such as forum and glossary attachments).&lt;br /&gt;
&lt;br /&gt;
==== Add file manager element ====&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$mform-&amp;gt;addElement(&#039;filemanager&#039;, &#039;attachments&#039;, get_string(&#039;attachment&#039;, &#039;moodle&#039;), null,&lt;br /&gt;
                    array(&#039;subdirs&#039; =&amp;gt; 0, &#039;maxbytes&#039; =&amp;gt; $maxbytes, &#039;areamaxbytes&#039; =&amp;gt; 10485760, &#039;maxfiles&#039; =&amp;gt; 50,&lt;br /&gt;
                          &#039;accepted_types&#039; =&amp;gt; array(&#039;document&#039;), &#039;return_types&#039;=&amp;gt; FILE_INTERNAL | FILE_EXTERNAL));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here are the fields for filemanager:&lt;br /&gt;
&lt;br /&gt;
;&#039;filemanager&#039;:This is a filemanager element :)&lt;br /&gt;
;elementname:The unique name of the element in the form&lt;br /&gt;
;elementlabel:The label string that users see &lt;br /&gt;
;attributes:(leave it as null)&lt;br /&gt;
;options: an array of further options for the filepicker (see below)&lt;br /&gt;
&lt;br /&gt;
The options array can contain:&lt;br /&gt;
&lt;br /&gt;
;subdirs:(Default 1) Are subdirectories allowed?  (true or false)&lt;br /&gt;
;maxbytes:(Default 0) Restricts the size of each individual file.&lt;br /&gt;
;areamaxbytes:(Default 0) Restricts the total size of all the files.&lt;br /&gt;
;maxfiles:(Default -1) Restricts the total number of files.&lt;br /&gt;
;accepted_types:(Default *) You can specify what file types are accepted by filemanager.  All current file types are listed in &amp;lt;code&amp;gt;get_mimetypes_array()&amp;lt;/code&amp;gt; in [https://github.com/moodle/moodle/blob/master/lib/classes/filetypes.php lib/classes/filetypes.php].&lt;br /&gt;
&lt;br /&gt;
Example usage:  &#039;&#039;&#039;array(&#039;audio&#039;, &#039;video&#039;, &#039;document&#039;)&#039;&#039;&#039;, you can include file extensions as well, for example: &#039;&#039;&#039;array(&#039;.txt&#039;, &#039;.jpg&#039;, &#039;audio&#039;)&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Load existing files into draft area ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if (empty($entry-&amp;gt;id)) {&lt;br /&gt;
    $entry = new stdClass;&lt;br /&gt;
    $entry-&amp;gt;id = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$draftitemid = file_get_submitted_draft_itemid(&#039;attachments&#039;);&lt;br /&gt;
&lt;br /&gt;
file_prepare_draft_area($draftitemid, $context-&amp;gt;id, &#039;mod_glossary&#039;, &#039;attachment&#039;, $entry-&amp;gt;id,&lt;br /&gt;
                        array(&#039;subdirs&#039; =&amp;gt; 0, &#039;maxbytes&#039; =&amp;gt; $maxbytes, &#039;maxfiles&#039; =&amp;gt; 50));&lt;br /&gt;
&lt;br /&gt;
$entry-&amp;gt;attachments = $draftitemid;&lt;br /&gt;
&lt;br /&gt;
$mform-&amp;gt;set_data($entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Store updated set of files ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if ($data = $mform-&amp;gt;get_data()) {&lt;br /&gt;
    // ... store or update $entry&lt;br /&gt;
    file_save_draft_area_files($data-&amp;gt;attachments, $context-&amp;gt;id, &#039;mod_glossary&#039;, &#039;attachment&#039;,&lt;br /&gt;
                   $entry-&amp;gt;id, array(&#039;subdirs&#039; =&amp;gt; 0, &#039;maxbytes&#039; =&amp;gt; $maxbytes, &#039;maxfiles&#039; =&amp;gt; 50));&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===editor===&lt;br /&gt;
There are two ways of using the editor element in code, the first one is easier but expects some standardized fields. The second method is more low level.&lt;br /&gt;
&lt;br /&gt;
====Simple use====&lt;br /&gt;
# name database fields: &#039;&#039;textfield&#039;&#039;, &#039;&#039;textfieldformat&#039;&#039; (and &#039;&#039;textfieldtrust&#039;&#039; if required)&lt;br /&gt;
# create options array.  note that context is the best, most local context you have available.&lt;br /&gt;
#:&amp;lt;code php&amp;gt;$textfieldoptions = array(&#039;trusttext&#039;=&amp;gt;true, &#039;subdirs&#039;=&amp;gt;true, &#039;maxfiles&#039;=&amp;gt;$maxfiles, &#039;maxbytes&#039;=&amp;gt;$maxbytes, &#039;context&#039;=&amp;gt;$context);&amp;lt;/code&amp;gt;&lt;br /&gt;
# add editor &#039;&#039;textfield_editor&#039;&#039; to moodle form, pass options through custom data in form constructor, set $data-&amp;gt;id to null if data not exist yet&lt;br /&gt;
#:&amp;lt;code php&amp;gt;$mform-&amp;gt;addElement(&#039;editor&#039;, &#039;textfield_editor&#039;, get_string(&#039;fieldname&#039;, &#039;somemodule&#039;), null, $textfieldoptions);&amp;lt;/code&amp;gt;&lt;br /&gt;
# prepare data&lt;br /&gt;
#:&amp;lt;code php&amp;gt;$data = file_prepare_standard_editor($data, &#039;textfield&#039;, $textfieldoptions, $context, &#039;mod_somemodule&#039;, &#039;somearea&#039;, $data-&amp;gt;id);&amp;lt;/code&amp;gt;&lt;br /&gt;
# get submitted data and after inserting/updating of data&lt;br /&gt;
#:&amp;lt;code php&amp;gt;$data = file_postupdate_standard_editor($data, &#039;textfield&#039;, $textfieldoptions, $context, &#039;mod_somemodule&#039;, &#039;somearea&#039;, $data-&amp;gt;id);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Real world examples are in mod/glossary/edit.php and mod/glossary/comment.php&lt;br /&gt;
&lt;br /&gt;
====Low level use====&lt;br /&gt;
&lt;br /&gt;
When using editor element you  need to preprocess and postprocess the data:&lt;br /&gt;
# detect if form was already submitted (usually means draft is area already exists) - &#039;&#039;file_get_submitted_draft_itemid()&#039;&#039;&lt;br /&gt;
# prepare draft file area, temporary storage of all files attached to the text - &#039;&#039;file_prepare_draft_area()&#039;&#039;&lt;br /&gt;
# convert encoded relative links to absolute links - &#039;&#039;file_prepare_draft_area()&#039;&#039;&lt;br /&gt;
# create form and set current data&lt;br /&gt;
# after submission the changed files must be merged back into original area - &#039;&#039;file_save_draft_area_files()&#039;&#039;&lt;br /&gt;
# absolute links have to be replaced by relative links - &#039;&#039;file_save_draft_area_files()&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=====Replace old htmleditor with editor=====&lt;br /&gt;
&lt;br /&gt;
The file picker has been integrated with with TinyMCE to make the editor element. This new element should support all types on editors and should be able to switch them on-the-fly. Instances of the old htmleditor element in your forms should be replaced by the new editor element, this may need adding of new format and trusttext columns. For example:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$mform-&amp;gt;addElement(&#039;editor&#039;, &#039;entry&#039;, get_string(&#039;definition&#039;, &#039;glossary&#039;), null,&lt;br /&gt;
        array(&#039;maxfiles&#039; =&amp;gt; EDITOR_UNLIMITED_FILES));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The editor element can take following options: maxfiles, maxbytes, subdirs and changeformat. Please note that the embedded files is optional feature and is not expected be used everywhere.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: the editor element now includes text format option. You should no longer use the separate format element type.&lt;br /&gt;
&lt;br /&gt;
=====Prepare current data - text and files=====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if (empty($entry-&amp;gt;id)) {&lt;br /&gt;
  $entry = new object();&lt;br /&gt;
  $entry-&amp;gt;id = null;&lt;br /&gt;
  $entry-&amp;gt;definition = &#039;&#039;;&lt;br /&gt;
  $entry-&amp;gt;format = FORMAT_HTML;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$draftid_editor = file_get_submitted_draft_itemid(&#039;entry&#039;);&lt;br /&gt;
$currenttext = file_prepare_draft_area($draftid_editor, $context-&amp;gt;id, &#039;mod_glossary&#039;, &#039;entry&#039;,&lt;br /&gt;
                                       $entry-&amp;gt;id, array(&#039;subdirs&#039;=&amp;gt;true), $entry-&amp;gt;definition);&lt;br /&gt;
$entry-&amp;gt;entry = array(&#039;text&#039;=&amp;gt;$currenttext, &#039;format&#039;=&amp;gt;$entry-&amp;gt;format, &#039;itemid&#039;=&amp;gt;$draftid_editor);&lt;br /&gt;
&lt;br /&gt;
$mform-&amp;gt;set_data($entry);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there are multiple files, they will share the same itemid.&lt;br /&gt;
&lt;br /&gt;
=====Obtain text, format and save draft files=====&lt;br /&gt;
&lt;br /&gt;
To retrieve editor content, you need to use following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if ($fromform = $mform-&amp;gt;get_data()) {&lt;br /&gt;
    // content of editor&lt;br /&gt;
    $messagetext = $fromform-&amp;gt;entry[&#039;text&#039;];&lt;br /&gt;
    // format of content&lt;br /&gt;
    $messageformat  = $fromform-&amp;gt;entry[&#039;format&#039;];&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a user selects a file using the file picker, the file is initially stored in a draft file area, and a URL is inserted into the HTML in the editor that lets the person editing the content (but no one else) see the file.&lt;br /&gt;
&lt;br /&gt;
When the user submits the form, we then need to save the draft files to the correct place in permanent storage. (Just like you have to call $DB-&amp;gt;update_record(&#039;tablename&#039;, $data); to have the other parts of the form submission stored correctly.)&lt;br /&gt;
&lt;br /&gt;
The save_files_from_draft_area function and replace absolute links with internal relative links do:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$messagetext = file_save_draft_area_files($draftid_editor, $context-&amp;gt;id, &#039;mod_glossary&#039;, &#039;entry&#039;,&lt;br /&gt;
                                          $entry-&amp;gt;id, array(&#039;subdirs&#039;=&amp;gt;true), $messagetext);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
; $context-&amp;gt;id, &#039;component&#039;, &#039;proper_file_area&#039; and $entry-&amp;gt;id : correspond to the contextid, filearea and itemid columns in the [[File_API#Table:_files|files table]].&lt;br /&gt;
; $messagetext : this is the message text. As the files are saved to the real file area, the URLs in this content are rewritten.&lt;br /&gt;
&lt;br /&gt;
All URLs in content that point to files managed to the File API are converted to a form that starts &#039;@@PLUGINFILE@@/&#039; before the content is stored in the database. That is what we mean by rewriting.&lt;br /&gt;
&lt;br /&gt;
== File serving==&lt;br /&gt;
&lt;br /&gt;
=== Convert internal relative links to absolute links ===&lt;br /&gt;
&lt;br /&gt;
Before text content is displayed to the user, any URLs in the &#039;@@PLUGINFILE@@/&#039; form in the content need to be rewritten to the real URL where the user can access the files. &lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$messagetext = file_rewrite_pluginfile_urls($messagetext, &#039;pluginfile.php&#039;,&lt;br /&gt;
        $context-&amp;gt;id, &#039;mod_mymodule&#039;, &#039;proper_file_area&#039;, $itemid);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
; $messagetext : is the content containing the @@PLUGINFILE@@ URLs from the database.&lt;br /&gt;
; &#039;pluginfile.php&#039; : there are a number of different scripts that can serve files with different permissions checks. You need to specify which one to use.&lt;br /&gt;
; $context-&amp;gt;id, &#039;mod_mymodule&#039;, &#039;proper_file_area&#039;, $itemid : uniquely identifies the file area, as before.&lt;br /&gt;
&lt;br /&gt;
=== Implement file serving access control ===&lt;br /&gt;
&lt;br /&gt;
Attachments and embedded images should have the same access control like the text itself, in majority of cases these files are served using pluginfile.php. Access control is defined in &#039;&#039;module/lib.php&#039;&#039; file in function &#039;&#039;module_pluginfile()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File browsing support ==&lt;br /&gt;
Only owner of each file area is allowed to use low level File API function to access files, other parts of Moodle should use file browsing API.&lt;br /&gt;
&lt;br /&gt;
Activities may specify browsing support in own module/lib.php file by implementing functions module_get_file_areas() and module_get_file_info().&lt;br /&gt;
&lt;br /&gt;
== Upgrading your code ==&lt;br /&gt;
Here I will attempt to describe some simple steps you can take to upgrade your file-handling form elements from pre-2.0 code to 2.0. We will use the example of glossary, since it has been used above.&lt;br /&gt;
&lt;br /&gt;
=== Preparing your options ===&lt;br /&gt;
Unless you are happy with the defaults, you will need to define an array of options for each file-handling form element. You could define it at different places, but it&#039;s best to put it in one place and make the array(s) available to other files if they need it. In the majority of cases, this will be in a file like edit.php&lt;br /&gt;
&lt;br /&gt;
Previous code in mod/glossary/edit.php:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$mform =&amp;amp; new mod_glossary_entry_form(null, compact(&#039;cm&#039;, &#039;glossary&#039;, &#039;hook&#039;, &#039;mode&#039;, &#039;e&#039;, &#039;context&#039;));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
New code:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$maxbytes = $course-&amp;gt;maxbytes;&lt;br /&gt;
// Could also use $CFG-&amp;gt;maxbytes if you are not coding within a course context&lt;br /&gt;
&lt;br /&gt;
$definitionoptions = array(&#039;subdirs&#039;=&amp;gt;false, &#039;maxfiles&#039;=&amp;gt;99, &#039;maxbytes&#039;=&amp;gt;$maxbytes, &#039;trusttext&#039;=&amp;gt;true,&lt;br /&gt;
                           &#039;context&#039;=&amp;gt;$context);&lt;br /&gt;
$attachmentoptions = array(&#039;subdirs&#039;=&amp;gt;false, &#039;maxfiles&#039;=&amp;gt;99, &#039;maxbytes&#039;=&amp;gt;$maxbytes);&lt;br /&gt;
$mform = new mod_glossary_entry_form(null, array(&#039;current&#039;=&amp;gt;$entry, &#039;cm&#039;=&amp;gt;$cm, &#039;glossary&#039;=&amp;gt;$glossary,&lt;br /&gt;
                                                 &#039;definitionoptions&#039;=&amp;gt;$definitionoptions, &lt;br /&gt;
                                                 &#039;attachmentoptions&#039;=&amp;gt;$attachmentoptions));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Note that the data being passed to the form constructor have changed also, but this is not part of the file API changes, I just include them to avoid confusion.&lt;br /&gt;
&lt;br /&gt;
These options are for the htmleditor (definition field) and the filemanager (attachment field). They are used by a file called edit_form.php.&lt;br /&gt;
&lt;br /&gt;
=== Element preparation ===&lt;br /&gt;
Before we look at this, however, we need to &amp;quot;prepare&amp;quot; the elements so that they can correctly display existing embedded images and attached files when you are editing a record instead of just creating one. So, let&#039;s take the code we&#039;ve got so far in edit.php and add to it:&lt;br /&gt;
&lt;br /&gt;
Currently upgraded code in edit.php:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$mform = new mod_glossary_entry_form(null, array(&lt;br /&gt;
        &#039;current&#039;=&amp;gt;$entry, &lt;br /&gt;
        &#039;cm&#039;=&amp;gt;$cm, &lt;br /&gt;
        &#039;glossary&#039;=&amp;gt;$glossary,&lt;br /&gt;
        &#039;definitionoptions&#039;=&amp;gt;$definitionoptions, &lt;br /&gt;
        &#039;attachmentoptions&#039;=&amp;gt;$attachmentoptions));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
New code with element preparation:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$entry = new stdClass();&lt;br /&gt;
$entry-&amp;gt;id = 0; \\ See notes!&lt;br /&gt;
$entry = file_prepare_standard_editor($entry, &#039;definition&#039;, $definitionoptions, $context,&lt;br /&gt;
                                      &#039;mod_glossary&#039;, &#039;entry&#039;, $entry-&amp;gt;id);&lt;br /&gt;
$entry = file_prepare_standard_filemanager($entry, &#039;attachment&#039;, $attachmentoptions, $context,&lt;br /&gt;
                                           &#039;mod_glossary&#039;, &#039;attachment&#039;, $entry-&amp;gt;id);&lt;br /&gt;
$mform = new mod_glossary_entry_form(null, array(&#039;current&#039;=&amp;gt;$entry, &#039;cm&#039;=&amp;gt;$cm, &#039;glossary&#039;=&amp;gt;$glossary,&lt;br /&gt;
                                                 &#039;definitionoptions&#039;=&amp;gt;$definitionoptions, &lt;br /&gt;
                                                 &#039;attachmentoptions&#039;=&amp;gt;$attachmentoptions));&lt;br /&gt;
$mform-&amp;gt;set_data($entry);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Things to note:&lt;br /&gt;
* $entry in this case is simply a stdClass object which may either represent a new glossary entry or an existing one.&lt;br /&gt;
* $entry-&amp;gt;id must be the unique identifier for the current object. If we are creating a new entry, it will be null, but in all cases it must be defined.&lt;br /&gt;
* These two functions (file_prepare_standard_editor and file_prepare_standard_filemanager) are shortcuts functions that take care of some of the tedious setting up for you, but they make a couple of assumptions:&lt;br /&gt;
*# You &#039;&#039;&#039;must&#039;&#039;&#039; name the form element as {element}_editor or {element}_filemanager (see next section)&lt;br /&gt;
*# You &#039;&#039;&#039;must&#039;&#039;&#039; have at least the following fields in the database: {element} and {element}summary, as described earlier in this documentation&lt;br /&gt;
*# $entry will be populated with a field (in this case) &#039;definition_filemanager&#039; having the draftfileid of your files. This needs to get passed to the &#039;value&#039; of the filemanager control in the form. If you get this wrong, existing file will not appear in the control when it is reloaded.&lt;br /&gt;
&lt;br /&gt;
We can now look at the upgrades needed in the form definition file.&lt;br /&gt;
&lt;br /&gt;
=== Form definition ===&lt;br /&gt;
Previous code in mod/glossary/edit_form.php:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$mform-&amp;gt;addElement(&#039;htmleditor&#039;, &#039;definition&#039;, get_string(&#039;definition&#039;, &#039;glossary&#039;),&lt;br /&gt;
                    array(&#039;rows&#039;=&amp;gt;20));&lt;br /&gt;
$mform-&amp;gt;setType(&#039;definition&#039;, PARAM_RAW);&lt;br /&gt;
$mform-&amp;gt;addRule(&#039;definition&#039;, null, &#039;required&#039;, null, &#039;client&#039;);&lt;br /&gt;
$mform-&amp;gt;setHelpButton(&#039;definition&#039;, array(&#039;writing&#039;, &#039;richtext&#039;), false, &#039;editorhelpbutton&#039;);&lt;br /&gt;
$mform-&amp;gt;addElement(&#039;format&#039;);&lt;br /&gt;
// a bit further...&lt;br /&gt;
$this-&amp;gt;set_upload_manager(new upload_manager(&#039;attachment&#039;, true, false, $COURSE, false, 0,&lt;br /&gt;
                                             true, true, false));&lt;br /&gt;
$mform-&amp;gt;addElement(&#039;file&#039;, &#039;attachment&#039;, get_string(&#039;attachment&#039;, &#039;forum&#039;));&lt;br /&gt;
$mform-&amp;gt;setHelpButton(&#039;attachment&#039;, array(&#039;attachment&#039;, get_string(&#039;attachment&#039;, &#039;glossary&#039;),&lt;br /&gt;
                      &#039;glossary&#039;));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
New code:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$definitionoptions = $this-&amp;gt;_customdata[&#039;definitionoptions&#039;];&lt;br /&gt;
$attachmentoptions = $this-&amp;gt;_customdata[&#039;attachmentoptions&#039;];&lt;br /&gt;
// a bit further...&lt;br /&gt;
$mform-&amp;gt;addElement(&#039;editor&#039;, &#039;definition_editor&#039;, get_string(&#039;definition&#039;, &#039;glossary&#039;), null,&lt;br /&gt;
                   $definitionoptions);&lt;br /&gt;
$mform-&amp;gt;setType(&#039;definition_editor&#039;, PARAM_RAW);&lt;br /&gt;
$mform-&amp;gt;addRule(&#039;definition_editor&#039;, get_string(&#039;required&#039;), &#039;required&#039;, null, &#039;client&#039;);&lt;br /&gt;
// a bit further...&lt;br /&gt;
$mform-&amp;gt;addElement(&#039;filemanager&#039;, &#039;attachment_filemanager&#039;, get_string(&#039;attachment&#039;, &#039;glossary&#039;),&lt;br /&gt;
                   null, $attachmentoptions);&lt;br /&gt;
$mform-&amp;gt;setHelpButton(&#039;attachment_filemanager&#039;, array(&#039;attachment2&#039;,&lt;br /&gt;
                      get_string(&#039;attachment&#039;, &#039;glossary&#039;), &#039;glossary&#039;));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the following:&lt;br /&gt;
* The format element and the help button are no longer required for the HTML editor element&lt;br /&gt;
* The name of the form element needs to be changed by adding &#039;_editor&#039; or &#039;_filemanager&#039; to the original name. This is a naming convention that is used by a couple of functions we will look at shortly&lt;br /&gt;
* Make sure $definitionoptions has context parameter, else system context is used and editor will not respect filter settings.&lt;br /&gt;
&lt;br /&gt;
=== Handling submitted data ===&lt;br /&gt;
The final step is to handle the submitted data properly, i.e. retrieve the files and save them to disk, associating them with the record we have just created (a glossary entry in our example). This happens in edit.php:&lt;br /&gt;
&lt;br /&gt;
Previous code in edit.php:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// Section that updates an entry:&lt;br /&gt;
$todb-&amp;gt;id = $e;&lt;br /&gt;
$dir = glossary_file_area_name($todb);&lt;br /&gt;
if ($mform-&amp;gt;save_files($dir) and $newfilename = $mform-&amp;gt;get_new_filename()) {&lt;br /&gt;
    $todb-&amp;gt;attachment = $newfilename;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Section that adds an entry:&lt;br /&gt;
if ($todb-&amp;gt;id = insert_record(&amp;quot;glossary_entries&amp;quot;, $todb)) {&lt;br /&gt;
    $e = $todb-&amp;gt;id;&lt;br /&gt;
    $dir = glossary_file_area_name($todb);&lt;br /&gt;
    if ($mform-&amp;gt;save_files($dir) and $newfilename = $mform-&amp;gt;get_new_filename()) {&lt;br /&gt;
        set_field(&amp;quot;glossary_entries&amp;quot;, &amp;quot;attachment&amp;quot;, $newfilename, &amp;quot;id&amp;quot;, $todb-&amp;gt;id);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
New code:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// $todb was renamed to $entry, and the code was refactored &lt;br /&gt;
// so that the file-handling code is only used once for either an add or an update action.&lt;br /&gt;
// If an entry is being added, $DB-&amp;gt;insert() has already been called, so we have a valid $entry-&amp;gt;id&lt;br /&gt;
$entry = file_postupdate_standard_editor($entry, &#039;definition&#039;, $definitionoptions, $context,&lt;br /&gt;
                                         &#039;mod_glossary&#039;, &#039;entry&#039;, $entry-&amp;gt;id);&lt;br /&gt;
$entry = file_postupdate_standard_filemanager($entry, &#039;attachment&#039;, $attachmentoptions, $context,&lt;br /&gt;
                                              &#039;mod_glossary&#039;, &#039;attachment&#039;, $entry-&amp;gt;id);&lt;br /&gt;
// store the updated value values&lt;br /&gt;
$DB-&amp;gt;update_record(&#039;glossary_entries&#039;, $entry);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Things to note:&lt;br /&gt;
* If you are adding a new record, you will still need to call update_record after calling the file_postupdate* functions&lt;br /&gt;
&lt;br /&gt;
=== Gotchas ===&lt;br /&gt;
A few things to keep in mind:&lt;br /&gt;
* Make sure that you instantiate the moodle form before any call to $OUTPUT-&amp;gt;header()&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[File API]]&lt;br /&gt;
* [[Using the file API]]&lt;br /&gt;
* [[Repository plugins]]&lt;br /&gt;
* [[Portfolio API]]&lt;br /&gt;
* MDL-14589 - File API Meta issue&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=207748 Adding a text editor to a Moodle form]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=157953#p692822 Button actions in Moodle form]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=351013#p1416554 File Picker]&lt;br /&gt;
* [https://github.com/CARLOSEDUARDOVIEIRA/moodle-uploadfile Example of filemanager in an activity module]&lt;br /&gt;
&lt;br /&gt;
[[Category:Files]]&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Miscellaneous_callbacks&amp;diff=55467</id>
		<title>Miscellaneous callbacks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Miscellaneous_callbacks&amp;diff=55467"/>
		<updated>2019-01-16T16:28:09Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* override_webservice_execution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains documentation for general callbacks available in Moodle plugins.&lt;br /&gt;
&lt;br /&gt;
== control_view_profile ==&lt;br /&gt;
&lt;br /&gt;
This callback allows an installation to control access to a user&#039;s profile page. It modifies the response of the user_can_view_profile function; this function is what causes Moodle to show a &#039;not allowed&#039; error message if you try to view somebody&#039;s profile when you aren&#039;t allowed to.&lt;br /&gt;
&lt;br /&gt;
You can use this callback if your institution needs to implement policies about who can view profiles in addition to those supported by standard Moodle. Normally it would be implemented in a local plugin, but you can implement in any type of plugin.&lt;br /&gt;
&lt;br /&gt;
Your callback can return one of three values (all constants defined in the core_user class):&lt;br /&gt;
&lt;br /&gt;
; VIEWPROFILE_DO_NOT_PREVENT : Use standard Moodle behaviour - apply Moodle&#039;s normal rules about whether the current user is allowed to view that profile or not. Your callback should return this if you don&#039;t need to change behaviour for the profile in question.&lt;br /&gt;
; VIEWPROFILE_PREVENT : Prevent the current user from viewing that user&#039;s profile, even if Moodle&#039;s normal rules would allow it.&lt;br /&gt;
; VIEWPROFILE_FORCE_ALLOW : Allow the current user to view that user&#039;s profile, even if Moodle&#039;s normal rules would prevent it.&lt;br /&gt;
&lt;br /&gt;
=== Example code ===&lt;br /&gt;
&lt;br /&gt;
This silly example, placed in local/myplugin/lib.php, prevents everyone from accessing the profile of a user &#039;abc123&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_myplugin_control_view_profile($user, $course = null, context_user $usercontext = null) {&lt;br /&gt;
    if ($user-&amp;gt;username=&#039;abc123&#039;) {&lt;br /&gt;
        return core_user::VIEWPROFILE_PREVENT;&lt;br /&gt;
    }&lt;br /&gt;
    return core_user::VIEWPROFILE_DO_NOT_PREVENT;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Multiple plugins ===&lt;br /&gt;
&lt;br /&gt;
The callback can be implemented by multiple plugins. Provided they behave sensibly and return DO_NOT_PREVENT when they don&#039;t need to modify behaviour, it should work as expected. The specific rules are:&lt;br /&gt;
&lt;br /&gt;
* If any function returns VIEWPROFILE_PREVENT then the user will be prevented from viewing the profile.&lt;br /&gt;
* Otherwise, if no function returns VIEWPROFILE_PREVENT but any function returns VIEWPROFILE_FORCE_ALLOW , then the user will be allowed to view the profile.&lt;br /&gt;
* Otherwise all plugins returned VIEWPROFILE_DO_NOT_PREVENT, and Moodle standard behaviour will be used.&lt;br /&gt;
&lt;br /&gt;
== store_profiling_data ==&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to get the profiling information from xhprof/tideways-xhprof and do it&#039;s own processing or storage with it.&lt;br /&gt;
&lt;br /&gt;
=== Example code === &lt;br /&gt;
&lt;br /&gt;
This is a fragment of a possible plugin that writes files to /tmp/output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_profilestorefile_store_profiling_data($rec) {&lt;br /&gt;
	$file = fopen(&amp;quot;/tmp/output/&amp;quot; . $rec-&amp;gt;runid, &amp;quot;w&amp;quot;) or die(&amp;quot;Unable to write to file, does the folder exist?&amp;quot;);&lt;br /&gt;
	fwrite($file, json_encode($rec));&lt;br /&gt;
	fclose($file);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== override_webservice_execution ==&lt;br /&gt;
{{Moodle 3.6}}&lt;br /&gt;
&lt;br /&gt;
This callback allows an installation to modify the standard behaviour of web service functions. It overrides the execution of the web service - the point where the actual function that does something is about to be called.&lt;br /&gt;
&lt;br /&gt;
It works with:&lt;br /&gt;
* Web service calls from the mobile app.&lt;br /&gt;
* Other web service calls using the token system.&lt;br /&gt;
* AJAX web service calls.&lt;br /&gt;
&lt;br /&gt;
You can call the standard function and modify the result, or do something entirely different.&lt;br /&gt;
&lt;br /&gt;
This callback &#039;&#039;&#039;should not be used in core code&#039;&#039;&#039;. It is designed to allow people a way to change the standard behaviour for their instance.&lt;br /&gt;
&lt;br /&gt;
Be aware that when you upgrade to a new Moodle version, the web service that you have overridden may change its definition or behaviour. In that case you would have to update this callback as well.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&lt;br /&gt;
The function is called with the web service function object (as returned by external_api::external_function_info) and a numerically-indexed array of the parameters for the function.&lt;br /&gt;
&lt;br /&gt;
* If the callback wants to override the function, it should return a value in the same format as returned by the real function. Moodle will check this return value to make sure it matches the web service return type definition.&lt;br /&gt;
* If the callback does not want to override the function, it should return false to allow standard execution.&lt;br /&gt;
&lt;br /&gt;
You will probably need to look at the code of the original implementation for the web service function so that you know how it works and what format the results are returned in.&lt;br /&gt;
&lt;br /&gt;
The callback can be implemented by multiple plugins. If it is implemented multiple times then the first function that doesn&#039;t return false (in the order that Moodle lists plugins) will be used.&lt;br /&gt;
&lt;br /&gt;
=== Example code ===&lt;br /&gt;
&lt;br /&gt;
This example, placed in &#039;&#039;&#039;local/myplugin/lib.php&#039;&#039;&#039;, changes the course list returned by the &#039;&#039;&#039;core_course_get_courses&#039;&#039;&#039; web service function so that it does not include a particular course. &lt;br /&gt;
&lt;br /&gt;
This will have the result of hiding the course from the mobile app. (It may have other undesirable effects within the mobile app - obviously, this override is not officially supported.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_myplugin_override_webservice_execution($function, $params) {&lt;br /&gt;
    // Check if it&#039;s the function we want to override.&lt;br /&gt;
    if ($function-&amp;gt;name === &#039;core_course_get_courses&#039;) {&lt;br /&gt;
        // Call the original function.&lt;br /&gt;
        $result = call_user_func_array([$function-&amp;gt;classname, $function-&amp;gt;methodname], $params);&lt;br /&gt;
&lt;br /&gt;
        // Get rid of a specific course from the results&lt;br /&gt;
        foreach ($result as $index =&amp;gt; $course) {&lt;br /&gt;
            if ($course[&#039;shortname&#039;] === &#039;SNEAKY&#039;) {&lt;br /&gt;
                unset($result[$index]);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        $result = array_values($result);&lt;br /&gt;
        return $result;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This second example modifies the &#039;&#039;&#039;core_fetch_notifications&#039;&#039;&#039; function, which is called by AJAX after every page load, to add a notification with the current time:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_myplugin_override_webservice_execution($function, $params) {&lt;br /&gt;
    // Check if it&#039;s the AJAX function that fetches notifications.&lt;br /&gt;
    if ($function-&amp;gt;name === &#039;core_fetch_notifications&#039;) {&lt;br /&gt;
        // Call the original function.&lt;br /&gt;
        $result = call_user_func_array([$function-&amp;gt;classname, $function-&amp;gt;methodname], $params);&lt;br /&gt;
&lt;br /&gt;
        // Add an extra notification.&lt;br /&gt;
        $result[] = [&lt;br /&gt;
            &#039;template&#039; =&amp;gt; &#039;core/notification_info&#039;,&lt;br /&gt;
            &#039;variables&#039; =&amp;gt; [&#039;message&#039; =&amp;gt; &#039;The time is: &#039; . date(&#039;H:i:s&#039;), &#039;extraclasses&#039; =&amp;gt; &#039;&#039;,&lt;br /&gt;
                &#039;closebutton&#039; =&amp;gt; false, &#039;announce&#039; =&amp;gt; true]&lt;br /&gt;
        ];&lt;br /&gt;
        return $result;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Security considerations ===&lt;br /&gt;
&lt;br /&gt;
This mechanism can bypass security checks. When this function is called, Moodle has checked the user&#039;s token or basic access but other checks have not yet been done.&lt;br /&gt;
&lt;br /&gt;
* If you call the original function, that function will apply its security checks as normal, so this part should be safe.&lt;br /&gt;
* If you add extra data to the result, or extra functionality, make sure you have checked the appropriate permissions for the current user.&lt;br /&gt;
* If you replace the original function, make sure you do all the relevant security checks (look at the source code of the original function).&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Javascript_Modules&amp;diff=47675</id>
		<title>Javascript Modules</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Javascript_Modules&amp;diff=47675"/>
		<updated>2015-04-24T17:29:27Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Embedding AMD code in a page - $OUTPUT wrong, changed to $PAGE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.9}}&lt;br /&gt;
&lt;br /&gt;
= Javascript Modules =&lt;br /&gt;
&lt;br /&gt;
== What is a Javascript module and why do I care? ==&lt;br /&gt;
&lt;br /&gt;
A Javascript module is nothing more than a collection of Javascript code that can be used (reliably) from other pieces of Javascript. &lt;br /&gt;
&lt;br /&gt;
== Why should I package my code as a module? ==&lt;br /&gt;
&lt;br /&gt;
By packaging your code as a module you break your code up into smaller reusable pieces. This is good because:&lt;br /&gt;
&lt;br /&gt;
a) Each smaller piece is simpler to understand / debug&lt;br /&gt;
&lt;br /&gt;
b) Each smaller piece is simpler to test&lt;br /&gt;
&lt;br /&gt;
c) You can re-use common code instead of duplicating it&lt;br /&gt;
&lt;br /&gt;
= How do I write a Javascript module in Moodle? =&lt;br /&gt;
&lt;br /&gt;
Since version 2.9(?), Moodle supports Javascript modules written using the Asynchronous Module Definition ([https://github.com/amdjs/amdjs-api/wiki/AMD AMD]) API. This is a standard API for creating Javascript modules and you will find many useful third party libraries that are already using this format. &lt;br /&gt;
&lt;br /&gt;
To edit or create an AMD module in Moodle you need to do a couple of things. &lt;br /&gt;
&lt;br /&gt;
== Install grunt ==&lt;br /&gt;
The AMD modules in Moodle must be processed by some build tools before they will be visible to your web browser. We use &amp;quot;[http://gruntjs.com/ grunt]&amp;quot; as a build tool to wrap our different processes. Grunt is a build tool written in Javascript that runs in the &amp;quot;[http://nodejs.org/ nodejs]&amp;quot; environment. This means you first have to install nodejs - and it&#039;s package manager &amp;quot;[https://www.npmjs.com/ npm]&amp;quot;. The details of how to install those packages will vary by operating system, but on Linux it&#039;s probably similar to &amp;quot;sudo apt-get install nodejs npm&amp;quot;. There are downloadable packages for other operating systems here: http://nodejs.org/download/. Once this is done, you can run the command: &amp;quot;npm install&amp;quot; from the top of the Moodle directory to install all of the required tools. &lt;br /&gt;
&lt;br /&gt;
== Running grunt ==&lt;br /&gt;
Grunt is a special node package in that it comes in 2 parts. One part is the grunt package that is installed in the node_modules folder by the &amp;quot;npm install&amp;quot; command listed in the previous section. The second part is that you also need to install the grunt-cli package globally in order to have a &amp;quot;grunt&amp;quot; command in your path. To do this run &amp;quot;npm install -g grunt-cli&amp;quot; (you may need additional permissions to do this). &lt;br /&gt;
&lt;br /&gt;
Now you can run the &amp;quot;grunt&amp;quot; command from any folder in Moodle and it should &amp;quot;build&amp;quot; all of the javascript from that directory and it&#039;s sub directories. &lt;br /&gt;
&lt;br /&gt;
When grunt runs it currently does 3 things:&lt;br /&gt;
&lt;br /&gt;
* - it runs [https://github.com/yui/shifter shifter] to build any YUI modules in the source tree. See [YUI/Shifter] for more information on shifter&lt;br /&gt;
* - it runs [http://jshint.com/ jshint] to detect invalid Javascript, or Javascript that does not comply with our coding guidelines&lt;br /&gt;
* - it runs [http://lisperator.net/uglifyjs/ uglifyjs] to reduce the size of any Javascript by removing whitespace, stripping comments, shortening variable names etc.&lt;br /&gt;
&lt;br /&gt;
You must run &amp;quot;grunt&amp;quot; after making any change to the Javascript in Moodle. &lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Hello World&amp;quot; I am a Javascript Module ==&lt;br /&gt;
Lets now create a simple Javascript module so we can see how to lay things out. &lt;br /&gt;
&lt;br /&gt;
Each Javascript module is contained in a single source file in the &amp;lt;componentdir&amp;gt;/amd/src folder. The final name of the module is taken from the file name and the component name. E.g. block_overview/amd/src/helloworld.js would be a module named &amp;quot;block_overview/helloworld&amp;quot;. the name of the module is important when you want to call it from somewhere else in the code. &lt;br /&gt;
&lt;br /&gt;
After running grunt - the minified Javascript files are stored in the &amp;lt;componentdir&amp;gt;/amd/build folder. The javascript files are renamed to show that they are minified (helloworld.js becomes helloworld.min.js). &lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to add the built files (the ones in amd/build) to your git commits, or in production no-one will see your changes. &lt;br /&gt;
&lt;br /&gt;
Lets create a simple module now:&lt;br /&gt;
&lt;br /&gt;
blocks/overview/amd/src/helloworld.js&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
// Standard license block omitted.&lt;br /&gt;
/*&lt;br /&gt;
 * @package    block_overview&lt;br /&gt;
 * @copyright  2015 Someone cool&lt;br /&gt;
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
 /**&lt;br /&gt;
  * @module block_overview/helloworld&lt;br /&gt;
  */&lt;br /&gt;
define([&#039;jquery&#039;], function($) {&lt;br /&gt;
&lt;br /&gt;
     /** &lt;br /&gt;
      * Give me blue.&lt;br /&gt;
      * @access private&lt;br /&gt;
      * @return {string}&lt;br /&gt;
      */&lt;br /&gt;
     var makeItBlue = function() {&lt;br /&gt;
          // We can use our jquery dependency here.&lt;br /&gt;
          return $(&#039;.blue&#039;).show();&lt;br /&gt;
     };&lt;br /&gt;
      &lt;br /&gt;
    /**&lt;br /&gt;
     * @constructor&lt;br /&gt;
     * @alias module:block_overview/helloworld&lt;br /&gt;
     */&lt;br /&gt;
    var greeting = function() {&lt;br /&gt;
        /** @access private */&lt;br /&gt;
        var privateThoughts = &#039;I like the colour blue&#039;;&lt;br /&gt;
        &lt;br /&gt;
        /** @access public */&lt;br /&gt;
        this.publicThoughts = &#039;I like the colour orange&#039;;&lt;br /&gt;
&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * A formal greeting.&lt;br /&gt;
     * @access public&lt;br /&gt;
     * @return {string}&lt;br /&gt;
     */&lt;br /&gt;
    greeting.prototype.formal = function() {&lt;br /&gt;
        return &#039;How do you do?&#039;;&lt;br /&gt;
    };&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * An informal greeting.&lt;br /&gt;
     * @access public&lt;br /&gt;
     * @return {string}&lt;br /&gt;
     */&lt;br /&gt;
    greeting.prototype.informal = function() {&lt;br /&gt;
        return &#039;Wassup!&#039;;&lt;br /&gt;
    };&lt;br /&gt;
    return greeting;&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most interesting line above is:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
define([&#039;jquery&#039;], function($) {&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All AMD modules must call &amp;quot;define()&amp;quot; as the first and only global scoped piece of code. This ensures the javascript code contains no global variables and will not conflict with any other loaded module. The name of the module does not need to be specified because it is determined from the filename and component (but it can be listed in a comment for JSDoc as shown here). &lt;br /&gt;
&lt;br /&gt;
The first argument to &amp;quot;define&amp;quot; is the list of dependencies for the module. This argument must be passed as an array, even if there is only one. In this example &amp;quot;jquery&amp;quot; is a dependency. &amp;quot;jquery&amp;quot; is shipped as a core module is available to all AMD modules. &lt;br /&gt;
&lt;br /&gt;
The second argument to &amp;quot;define&amp;quot; is the function that defines the module. This function will receive as arguments, each of the requested dependencies in the same order they were requested. In this example we receive JQuery as an argument and we name the variable &amp;quot;$&amp;quot; (it&#039;s a JQuery thing). We can then access JQuery normally through the $ variable which is in scope for any code in our module. &lt;br /&gt;
&lt;br /&gt;
The rest of the code in this example is a standard way to define a Javascript module with public/private variables and methods. There are many ways to do this, this is only one.&lt;br /&gt;
&lt;br /&gt;
It is important that we are returning &#039;greeting&#039;. If there is no return then your module will be declared as undefined.&lt;br /&gt;
&lt;br /&gt;
== Loading modules dynamically ==&lt;br /&gt;
What do you do if you don&#039;t know in advance which modules will be required? Stuffing all possible required modules in the define call is one solution, but it&#039;s ugly and it only works for code that is in an AMD module (what about inline code in the page?). AMD lets you load a dependency any time you like. &lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Load a new dependency.&lt;br /&gt;
require([&#039;mod_wiki/timer&#039;], function(timer) {&lt;br /&gt;
   // timer is available to do my bidding.&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Embedding AMD code in a page ==&lt;br /&gt;
So you have created lots of cool Javascript modules. Great. How do we actually call them? Any javascript code that calls an AMD module must execute AFTER the requirejs module loader has finished loading. We have provided a function &amp;quot;js_call_amd&amp;quot; that will call a single function from an AMD module with parameters.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$PAGE-&amp;gt;requires-&amp;gt;js_call_amd($modulename, $functionname, $params);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that will &amp;quot;do the right thing&amp;quot; with your block of AMD code and execute it at the end of the page, after our AMD module loader has loaded. &lt;br /&gt;
Notes:&lt;br /&gt;
* the $modulename is the &#039;componentname/modulename&#039; discussed above&lt;br /&gt;
* the $functionname is the name of a public function exposed by the amd module. &lt;br /&gt;
* the $params is an array of params passed as arguments to the function. These should be simple types that can be handled by json_encode (no recursive arrays, or complex classes please). &lt;br /&gt;
* if the size of the params array is too large (&amp;gt; 1Kb), this will produce a developer warning. Do not attempt to pass large amounts of data through this function, it will pollute the page size. A preferred approach is to pass css selectors for DOM elements that contain data-attributes for any required data, or fetch data via ajax in the background.&lt;br /&gt;
&lt;br /&gt;
== But I have a mega JS file I don&#039;t want loaded on every page? ==&lt;br /&gt;
Loading all JS files at once and stuffing them in the browser cache is the right choice for MOST js files, there are probably some exceptions. For these files, you can rename the javascript file to end with the suffix &amp;quot;-lazy.js&amp;quot; which indicates that the module will not be loaded by default, it will be requested the first time it is used. There is no difference in usage for lazy loaded modules, the require() call looks exactly the same, it&#039;s just that the module name will also have the &amp;quot;-lazy&amp;quot; suffix.&lt;br /&gt;
&lt;br /&gt;
[[Category:AJAX]]&lt;br /&gt;
[[Category:Javascript]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=44316</id>
		<title>Themes overview</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=44316"/>
		<updated>2014-04-06T19:00:08Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Font file locations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}Welcome to the new world of themes in Moodle 2.x!&lt;br /&gt;
&lt;br /&gt;
A Moodle theme allows the user to change the look and feel of a Moodle site.  Themes can be applied on the site, category, course and activity levels by users with permissions to do so.  Themes can be designed for specific devices such as mobile phones or tablets. This page explains how themes work in Moodle and is intended to help you create or modify most themes for Moodle 2.0&lt;br /&gt;
&lt;br /&gt;
You can use contributed themes or create your entire own to share with the community. Themes can also be based on parent themes with only few customizations. Themes accomplish this using CSS, changing the underlying markup structure and also adding Javascript to add more advanced behaviors.&lt;br /&gt;
&lt;br /&gt;
Most theme developers simply add a few changes to their new theme by basing it on an existing one. The Moodle Theme architecture is designed in such a way whereby the base theme will act as a fall-back that is used when nothing has been defined in the theme based on it. This makes it easy to create new themes that simply seek out to make minor changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.6==&lt;br /&gt;
{{Moodle 2.6}}&lt;br /&gt;
&lt;br /&gt;
===Fonts===&lt;br /&gt;
&lt;br /&gt;
CSS3 fonts can be now used in plugins, core and moodle themes. It is very similar to images in pix subdirectories (MDL-23493).&lt;br /&gt;
&lt;br /&gt;
===Chat Activity===&lt;br /&gt;
The Chat room window is now also styled via bootstrapbase. Themes based on bootstrapbase can now directly style or use &#039;customcss&#039; to style the chat window now. (MDL-42711)&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.5==&lt;br /&gt;
{{Moodle 2.5}}&lt;br /&gt;
&lt;br /&gt;
There is a new Bootstrap base theme. See [[Clean theme]] for more information.&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.4==&lt;br /&gt;
{{Moodle 2.4}}&lt;br /&gt;
&lt;br /&gt;
===HTML 5 doctype===&lt;br /&gt;
&lt;br /&gt;
By default Moodle is sending HTML5 doctype. Themes designers may decide to force old xhtml strict mode, but it is strongly discouraged and the site will not pass strictness validation. (MDL-34299)&lt;br /&gt;
&lt;br /&gt;
===Internet Explorer standards mode===&lt;br /&gt;
&lt;br /&gt;
Since 2.4 Moodle automatically sends X-UA-Compatible edge header, this should prevent Internet Explorer from switching to quirks or compatibility modes (MDL-36524). There is also a new workaround for intranet servers which previously identified recent IE browsers as IE7. (MDL-36481)&lt;br /&gt;
&lt;br /&gt;
===SVG icons===&lt;br /&gt;
&lt;br /&gt;
Most modern browsers support SVG icons. The benefit is that SVG scales perfectly to any screen resolution or zoom. It is now possible to add icons in SVG format to pix directories, Moodle uses SVG in supported browsers and PNG in legacy browsers. (MDL-22955)&lt;br /&gt;
&lt;br /&gt;
Please note that IE9 does not handle scaling of standard SVG icons properly, you may have to manually execute a special script from theme/base/cli/svgtool.php to alter the icons to be compatible with buggy IE9. (MDL-36436)&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.0==&lt;br /&gt;
&lt;br /&gt;
The theme system was completely redesigned in Moodle 2.0.  Known issues have been addressed and new features have been added to meet community requests.&lt;br /&gt;
&lt;br /&gt;
Unfortunately it was not possible to maintain backward compatibility, so all Moodle 1.x themes need to be recreated for Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
Major changes include:&lt;br /&gt;
* Clearer and more consistent CSS classes and IDs throughout all pages in Moodle&lt;br /&gt;
* Introduction of layout files (templates) describing overall layout HTML for many different types of pages in Moodle.&lt;br /&gt;
* Introduction of renderers, which produce the smaller &amp;quot;parts&amp;quot; of a HTML page.  Advanced themes can choose to override these too if they choose.&lt;br /&gt;
* Introduction of standard methods for adding Javascript to themes.&lt;br /&gt;
* Easier control over icons and images in Moodle.&lt;br /&gt;
* The old &amp;quot;standard&amp;quot; theme has been split into two themes:&lt;br /&gt;
**&#039;&#039;&#039;base&#039;&#039;&#039; - contains absolutely basic layout, and&lt;br /&gt;
**&#039;&#039;&#039;standard&#039;&#039;&#039; - which adds CSS to the base theme to make it look like the old standard theme.&lt;br /&gt;
* Performance tuning: In normal production mode CSS files are combined into a single optimised file, and both CSS and JavaScript files are minimised to ensure there are no wasted connections or traffic.  Files are heavily cached, but also versioned, so that users never need to clear their caches.&lt;br /&gt;
&lt;br /&gt;
==The structure of a theme==&lt;br /&gt;
&lt;br /&gt;
Some important things to know when building good themes:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;config.php&#039;&#039;&#039; - this file is required in every theme.  It defines configuration settings and definitions required to make the theme work in Moodle. These include theme, file, region, default region and options. &lt;br /&gt;
# &#039;&#039;&#039;Layouts and layout files&#039;&#039;&#039; -  in config.php there is one definition for each page type (see [[#theme_layouts_table|Appendix A: Theme layouts]] for a list of over 12 types).  Each page type definition tells Moodle which layout file will be used, what block regions this page type should display and so on.  The layout file contains the HTML and the minimum PHP required to display basic structure of pages. (If you know Moodle 1.9, it&#039;s like a combination of header.html and footer.html).&lt;br /&gt;
# &#039;&#039;&#039;The base theme&#039;&#039;&#039; - is not intended to be used for production sites.  It sets up the simplest possible generic layout and includes only CSS essential to that layout &#039;&#039;or&#039;&#039; to Moodle as a whole.  It tries not to make any unnecessary rules and makes as few assumptions as possible.  It&#039;s the perfect base on which to start designing a theme, as there are very few colours, borders, margins, and alignments to override.  You can just start adding what you need.&lt;br /&gt;
&lt;br /&gt;
===Files and folders===&lt;br /&gt;
A theme&#039;s files are placed in a folder with under moodle/theme folder and have subfolders. They are laid out like this:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Directory&lt;br /&gt;
! File&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| config.php&lt;br /&gt;
| Contains all of the configuration and definitions for each theme&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| lib.php &lt;br /&gt;
| Contains speciality classes and functions that are used by theme&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| renderers.php &lt;br /&gt;
| Contains any custom renderers for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| settings.php &lt;br /&gt;
| Contains custom theme settings. These local settings are defined by the theme allowing the theme user to easily alter something about the way it looks or operates. (eg a background colour, or a header image)&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| version.php &lt;br /&gt;
| Contains the theme name, version number and Moodle version requirements for using the theme&lt;br /&gt;
|-&lt;br /&gt;
| /fonts/&lt;br /&gt;
| *.woff, *.ttf, *.eot, *.svg, *.otf&lt;br /&gt;
| Theme fonts (since 2.6).&lt;br /&gt;
|-&lt;br /&gt;
| /fonts_core/ &lt;br /&gt;
| *.woff, *.ttf, *.eot, *.svg, *.otf&lt;br /&gt;
| Contains fonts that override standard core fonts (since 2.6).&lt;br /&gt;
|-&lt;br /&gt;
| /fonts_plugins/plugintype/pluginname/ &lt;br /&gt;
| *.woff, *.ttf, *.eot, *.svg, *.otf&lt;br /&gt;
| Contains fonts that override plugin fonts (since 2.6).&lt;br /&gt;
|-&lt;br /&gt;
| /javascript/ &lt;br /&gt;
| *.js&lt;br /&gt;
| All specialty JavaScript files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /lang/ &lt;br /&gt;
| &lt;br /&gt;
| Any special language files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /layout/ &lt;br /&gt;
| *.php&lt;br /&gt;
| Contains the layout files for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/ &lt;br /&gt;
| *.png, *.jpg, *.gif, *.svg&lt;br /&gt;
| Contains any images the theme makes use of either in CSS or in the layout files.&lt;br /&gt;
|-&lt;br /&gt;
|  /pix/&lt;br /&gt;
| favicon.ico &lt;br /&gt;
| The favicon to display for this theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/&lt;br /&gt;
| screenshot.png &lt;br /&gt;
| A screenshot of the theme to be displayed in on the theme selection screen.&lt;br /&gt;
|-&lt;br /&gt;
| /pix_core/ &lt;br /&gt;
| *.png, *.jpg, *.gif, *.svg&lt;br /&gt;
| Contains images that override standard core images.&lt;br /&gt;
|-&lt;br /&gt;
| /pix_plugins/plugintype/pluginname/ &lt;br /&gt;
| *.png, *.jpg, *.gif, *.svg&lt;br /&gt;
| Contains images that override plugin images.&lt;br /&gt;
|-&lt;br /&gt;
| /style/&lt;br /&gt;
| *.css&lt;br /&gt;
| Default location for CSS files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are also several other places that stylesheets can be included from (see the CSS how and why section below).&lt;br /&gt;
&lt;br /&gt;
It is possible to override icons used in base themes without interfering with core code by placing these in dataroot/pix and dataroot/pix_plugins. Where a theme extends a base theme and provides its own icons, these icons will still be used.&lt;br /&gt;
&lt;br /&gt;
==Theme options==&lt;br /&gt;
All theme options are set within the config.php file for the theme.  The settings that are most used are: parents, sheets, layouts, and javascripts. Have a look at the &#039;&#039;&#039;[[#theme_options_table|theme options table]]&#039;&#039;&#039; for a complete list of theme options which include lesser used specialised or advanced settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Basic theme config example===&lt;br /&gt;
Lets have a look at a basic theme configuration file and the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;newtheme&#039;;&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;parents = array(&lt;br /&gt;
    &#039;base&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;admin&#039;,&lt;br /&gt;
    &#039;blocks&#039;,&lt;br /&gt;
    &#039;calendar&#039;,&lt;br /&gt;
    &#039;course&#039;,&lt;br /&gt;
    &#039;grade&#039;,&lt;br /&gt;
    &#039;message&#039;,&lt;br /&gt;
    &#039;question&#039;,&lt;br /&gt;
    &#039;user&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    )&lt;br /&gt;
    //.......&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;javascripts_footer = array(&lt;br /&gt;
    &#039;navigation&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic theme example settings explained===&lt;br /&gt;
First up you will notice everything is added to $THEME. This is the theme&#039;s configuration object, it is created by Moodle using default settings and is then updated by whatever settings you add to it.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;name : The first setting, is the theme&#039;s name. This should simply be whatever your theme&#039;s name is, most likely whatever you named your theme directory.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;parents : This defines the themes that the theme will extend. In this case it is extending only the base theme.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;sheets : An array containing the names of the CSS stylesheets to include for this theme. Note that it is just the name of the stylesheet and does not contain the directory or the file extension. Moodle assumes that the theme&#039;s stylesheets will be located in the styles directory of the theme and have .css as an extension.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;layouts : In this example, two layouts have been defined to override the layouts from the base theme. For more information see the [[#Layouts|layouts]] section below.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;javascripts_footer : The final setting is to include a JavaScript file. Much like stylesheets, you only need to provide the files name. Moodle will assume it is in your themes JavaScript directory and be a .js file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: When you first begin writing themes, make sure you take a look at the configuration files of the other themes that get shipped with Moodle. You will get a good picture of how everything works, and what is going on in a theme, simply by reading it and taking notice of what it is including or excluding.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
===Locations of CSS files===&lt;br /&gt;
First lets look at where CSS can be included from within Moodle:&lt;br /&gt;
; \theme\themename\style\*.css : This is the default location for all of the stylesheets that are used by a theme and the place which should be used by a theme designer.&lt;br /&gt;
&lt;br /&gt;
New theme developers should note that the order in which CSS files are found and included creates a hierarchy.  This order ensures that the rules, within a theme&#039;s style sheets, take precedence over identical rules in other files that may have been introduced before.  This can both extend another files definitions (see parent array in the config file) and also ensures that the current theme&#039;s CSS rules/definitions have the last say.&lt;br /&gt;
&lt;br /&gt;
There are other locations that can be used (although very rarely) to include CSS in a page. A developer of a php file can manually specify a stylesheet from anywhere within Moodle, like the database. Usually, if code is doing this, it is because there is a non-theme config or plugin setting that contains information requires special CSS information.  As a theme designer you should be aware of, but not have to worry about, these locations of CSS files.  Here are some examples:&lt;br /&gt;
&lt;br /&gt;
; {pluginpath}\styles.css e.g. \block\blockname\styles.css or \mod\modname\styles.css : Every plugin can have its own styles.css file. This file should only contain the required CSS rules for the module and should not add anything to the look of the plugin such as colours, font sizes, or margins other than those that are truly required.&amp;lt;br /&amp;gt;Theme specific styles for a plugin should be located within the themes styles directory.&lt;br /&gt;
; {pluginpath}\styles_themename.css : This should only ever be used by plugin developers. It allows them to write CSS that is designed for a specific theme without having to make changes to that theme. You will notice that this is never used within Moodle and is designed to be used only by contributed code.&lt;br /&gt;
&lt;br /&gt;
As theme designers, we will only use the first method of introducing CSS: adding rules to a stylesheet file located in the theme&#039;s style directory.&lt;br /&gt;
&lt;br /&gt;
===Moodle&#039;s core CSS organisation===&lt;br /&gt;
The next thing to look at is the organisation of CSS and rules within a theme. Although as a theme designer it is entirely up to you as to how you create and organise your CSS. Please note that within the themes provided in the standard install by Moodle there is a very clear organisation of CSS.&lt;br /&gt;
&lt;br /&gt;
First is the  pagelayout.css file. This contains the CSS required to give the layouts their look and feel.  It doesn&#039;t contain any rules that affect the content generated by Moodle.&lt;br /&gt;
&lt;br /&gt;
Next is the core.css file. If you open up core you will notice that it contains all manner of general (usually simple) rules that don&#039;t relate to a specific section of Moodle but to Moodle as a whole.&lt;br /&gt;
&lt;br /&gt;
There can also be rules that relate to specific sections.  However, this is done only when there are only a handful of rules for that section. These small clusters of rules are grouped together and separated by comments identifying for which section each relates.&lt;br /&gt;
&lt;br /&gt;
Finally there are all the other CSS files, you will notice that there is a file for each section of Moodle that has a significant collection of rules.&lt;br /&gt;
&lt;br /&gt;
:For those who are familiar with Moodle 1.9 theme&#039;s, this organisation will be a big change. In 1.9, CSS was organised by its nature (for example: colours, layout, other).&lt;br /&gt;
&lt;br /&gt;
===How to write effective CSS rules within Moodle===&lt;br /&gt;
In Moodle 2.0, writing good CSS rules is incredibly important.&lt;br /&gt;
&lt;br /&gt;
Due to performance requirements and browser limitations, all of the CSS files are combined into a single CSS file that gets included every time. This means that rules need to be written in such a way as to minimise the chances of a collision leading to unwanted styles being applied. Whilst writing good CSS is something most designers strive for we have implemented several new body classes and prompt developers to use appropriate classnames.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;body&amp;gt; CSS id and classes ====&lt;br /&gt;
As of Moodle 2.0 the ID tag that gets applied to the body will always be a representation of the URI. For example if you are looking at a forum posting and the URI is &#039;/mod/forum/view.php&#039; then the body tags ID will be &#039;#page-mod-forum-view&#039;.&lt;br /&gt;
&lt;br /&gt;
As well as the body&#039;s ID attribute the URI is also exploded to form several CSS classes that get added to the body tag, so in the above example &#039;/mod/forum/view&#039; you would end up with the following classes being added to the body tag &#039;.path-mod&#039;, &#039;.path-mod-forum&#039;. Note that &#039;.path-mod-forum-view&#039; is not added as a class, this is intentionally left out to lessen confusion and duplication as rules can relate directly to the page by using the ID and do not require the final class.&lt;br /&gt;
&lt;br /&gt;
The body ID and body classes described above will form the bread and butter for many of the CSS rules you will need to write for your theme, however there are also several other very handy classes that get added to the body tag that will be beneficial to you once you start your journey down the rabbit hole that is themeing. Some of the more interesting classes are listed below.&lt;br /&gt;
&lt;br /&gt;
* If JavaScript is enabled then &#039;jsenabled&#039; will be added as a class to the body tag allowing you to style based on JavaScript being enabled or not.&lt;br /&gt;
* Either &#039;dir-rtl&#039; or &#039;dir-ltr&#039; will be added to the body as a class depending on the direction of the language pack: rtl = right to left, ltr = left to right. This allows you to determine your text-alignment based on language if required.&lt;br /&gt;
* A class will be added to represent the language pack currently in use, by default en_utf8 is used by Moodle and will result in the class &#039;lang-en_utf8&#039; being added to the body tag.&lt;br /&gt;
* The wwwroot for Moodle will also be converted to a class and added to the body tag allowing you to stylise your theme based on the URL through which it was reached. e.g. http://sam.moodle.local/moodle/ will become &#039;.sam-moodle-local—moodle&#039;&lt;br /&gt;
* If the current user is not logged then &#039;.notloggedin&#039; will be added to the body tag.&lt;br /&gt;
&lt;br /&gt;
What does all of this look like in practise? Well using the above example /mod/forum/view.php you would get at least the following body tag:&lt;br /&gt;
&amp;lt;code html4strict&amp;gt;&amp;lt;body id=”page-mod-forum-view” class=”path-mod path-mod-forum” /&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Writing your rules====&lt;br /&gt;
&lt;br /&gt;
By following the [[CSS coding style]] and CSS best-practices and understanding the [http://htmlhelp.com/reference/css/structure.html#cascade cascading order] of CSS a theme developer will reduce collisions and lines of CSS that is written. CSS classes have been placed where it is believed anyone may want to apply their own styles.&lt;br /&gt;
&lt;br /&gt;
When starting to write rules make sure that you have a good understanding of where you want those rules to be applied, it is a good idea to make the most of the body classes mentioned above.&lt;br /&gt;
If you want to write a rule for a specific page make use of the body tag&#039;s ID, e.g.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;#page-mod-forum-view .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to write a rule that will be applied all throughout the forum.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;.path-mod-forum .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The other very important thing to take into consideration is the structure leading up to the tag you want to style. Browsers apply conflicting styles with priority on the more specific selectors. It can be very beneficial to keep this in mind and write full selectors that rely on the structure of the tags leading to the tag you wish to style.&lt;br /&gt;
&lt;br /&gt;
By making use of body id&#039;s and classes and writing selectors to take into account the leading structure you can greatly minimise the chance of a collision both with Moodle now and in the future.&lt;br /&gt;
&lt;br /&gt;
==Layouts==&lt;br /&gt;
Layouts are defined in &#039;&#039;&#039;config.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
All themes are required to define the layouts they wish to be responsible for as well as create; however, many layout files are required by those layouts. If the theme is overriding another theme then it is a case of deciding which layouts this new theme should override. If the theme is a completely fresh start then you will need to define a layout for each of the different possibilities. &lt;br /&gt;
&lt;br /&gt;
It is also important to note that a new theme that will base itself on another theme (overriding it) does not need to define any layouts or use any layout files if there are no changes that it wishes to make to the layouts of the existing theme. The standard theme in Moodle is a good example of this as it extends the base theme simply adding CSS to achieve its look and feel.&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, layouts are defined in config.php within $THEME-&amp;gt;layouts. The following is an example of one such layout definition:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    // Standard layout with blocks, this is recommended for most pages with general information&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;base&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;&lt;br /&gt;
    )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The first thing Moodle looks at is the name of the layout, in this case it is `standard` (the array key in PHP), it then looks at the settings for the layout, this is the theme, file, regions, and default region. There are also a couple of other options that can be set by a layout.&lt;br /&gt;
&lt;br /&gt;
; theme : is the theme the layout file exists in. That&#039;s right: you can make use of layouts from other installed themes. &#039;&#039;Optional&#039;&#039;&lt;br /&gt;
; file : is the name of the layout file this layout wants to use. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; regions : is the different block regions (places you can put blocks) within the theme. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; defaultregion : is the default location when adding new blocks. &#039;&#039;&#039;Required if regions is non-empty, otherwise optional&#039;&#039;&#039;&lt;br /&gt;
; options : an array of layout specific options described in detail below. &#039;&#039;&#039;Optional&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;theme&#039;&#039;&#039; is optional. Normally the the layout file is looked for in the current theme, or, if it is not there, in the parent theme. However, you can use a layout file from any other theme by giving the theme name here.&lt;br /&gt;
&lt;br /&gt;
You can define whatever regions you like. You just need to pick a name for each one. Most themes just use one or both of &#039;&#039;&#039;side_pre&#039;&#039;&#039; and &#039;&#039;&#039;side_post&#039;&#039;&#039;, which is like &#039;left side&#039; and &#039;right side&#039;, except in right to left languages, when they are reversed. If you say in config.php that your the layout provides regions called &#039;fred&#039; and &#039;barney&#039;, then you must call $OUTPUT-&amp;gt;blocks_for_region(&#039;fred&#039;) and $OUTPUT-&amp;gt;blocks_for_region(&#039;barney&#039;) somewhere in the layout file.&lt;br /&gt;
&lt;br /&gt;
The final setting &#039;&#039;&#039;options&#039;&#039;&#039; is a special case that only needs to be set if you want to make use of it. This setting allows the theme designer to specify special options that they would like to create that can be later accessed within the layout file. This allows the theme to make design decisions during the definition and react upon those decisions in what ever layout file is being used.&lt;br /&gt;
&lt;br /&gt;
One such place this has been used is within the base theme. If you take a look first at theme/base/config.php you will notice that several layouts specify options &#039;&#039;&#039;nonavbar&#039;&#039;&#039; and &#039;&#039;&#039;nofooter&#039;&#039;&#039; which can both be set to either true or false. Then if we take a look at theme/base/layout/general.php you will spot lines like the following:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hasnavbar = (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar());&lt;br /&gt;
$hasfooter = (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;]));&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
............&lt;br /&gt;
&amp;lt;?php if ($hasnavbar) { ?&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
What you are seeing here is the use of those settings from the layout within the layout file. In this case it is being used to toggle the display of the navigation bar and page footer.&lt;br /&gt;
&lt;br /&gt;
==Layout files==&lt;br /&gt;
A layout file is a file that contains the core HTML structure for a layout including the header, footer, content and block regions. For those of you who are familiar with themes in Moodle 1.9 this is simply header.html and footer.html combined. Of course it is not all HTML, there are bits of HTML and content that Moodle needs to put into the page, within each layout file this will be done by a couple of simple PHP calls to get bits and pieces including content.&lt;br /&gt;
&lt;br /&gt;
Before learning more it is good to understand the two primary objects that will be used in your layout files: $OUTPUT and $PAGE.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$OUTPUT&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;core_renderer&amp;lt;/code&amp;gt; class which is defined in lib/outputrenderers.php. Each method is clearly documented there, along with which is appropriate for use within the layout files.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$PAGE&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;moodle_page&amp;lt;/code&amp;gt; class defined in lib/pagelib.php. Most of the things you will want to use are the properties that are all documented at the top of the file. If you are not familiar with PHP properties, you access them like $PAGE-&amp;gt;activityname, just like fields of an ordinary PHP object. (However, behind the scenes the value you get is produced by calling a function. Also, you cannot change these values, they are &#039;&#039;&#039;read-only&#039;&#039;&#039;. However, you don&#039;t need to understand all that if you are just using these properties in your theme.)&lt;br /&gt;
&lt;br /&gt;
The following is a very simple layout file to illustrate the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid) ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses) ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;table id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
            &amp;lt;?php&lt;br /&gt;
            echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
            ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We assume you know enough HTML to understand the basic structure above, but let&#039;s explain the PHP code since that is less obvious.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This occurs at the VERY top of the page, it must be the first bit of output and is responsible for adding the (X)HTML document type definition to the page. This of course is determined by the settings of the site and is one of the things that the theme designer has no control over.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we have started writing the opening html tag and have asked Moodle to give us the HTML attributes that should be applied to it. This again is determined by several settings within the actual HTML install.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This gets us the title for the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This very important call gets us the standard head HTML that needs to be within the HEAD tag of the page. This is where CSS and JavaScript requirements for the top of the page will be output as well as any special script or style tags.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid); ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses); ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Much like the html tag above we have started writing the body tag and have asked for Moodle to get us the desired ID and classes that should be applied to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading; ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are creating the header for the page. In this case we want the heading for the page, we want to display the login information which will be the current users username or a link to log in if they are not logged in, and we want the heading menu if there is one.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-pre&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is one of the most important calls within the file, it determines where the actual content for the page gets inserted.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-post&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This final bit of code gets the content for the footer of the page. It gets the login information which is the same as in the header, a home link, and the standard footer HTML which like the standard head HTML contains all of the script and style tags required by the page and requested to go in the footer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: Within Moodle 2.0 most of the JavaScript for the page will be included in the footer. This greatly helps reduce the loading time of the page.&lt;br /&gt;
&lt;br /&gt;
When writing layout files think about the different layouts and how the HTML that each makes use of will differ. You will most likely find you do not need a different layout file for each layout, most likely you will be able to reuse the layout files you create across several layouts. You can of course make use of layout options as well to further reduce the number of layout files you need to produce.&lt;br /&gt;
&lt;br /&gt;
Of course as mentioned above if you are customising an existing theme then you may not need to create any layouts or layout files at all.&lt;br /&gt;
&lt;br /&gt;
==Language File==&lt;br /&gt;
&lt;br /&gt;
You need to create a language file for your theme with a few standard strings in it. At a minimum create a file called lang/en/theme_themename.php in your theme folder. For example, the &#039;standard&#039; theme has a language file called lang/en/theme_standard.php. &lt;br /&gt;
&lt;br /&gt;
You &#039;&#039;&#039;must&#039;&#039;&#039; define the following lines in your file (example is from standard theme, adapt as required):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Standard&#039;;&lt;br /&gt;
$string[&#039;region-side-post&#039;] = &#039;Right&#039;;&lt;br /&gt;
$string[&#039;region-side-pre&#039;] = &#039;Left&#039;;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;This theme is a very basic white theme, with a minimum amount of &lt;br /&gt;
 CSS added to the base theme to make it actually usable.&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without the above you will get notices for the missing strings.&lt;br /&gt;
&lt;br /&gt;
==Making use of images==&lt;br /&gt;
Right at the start when listing the features of the new themes system one of the features mentioned was the ability to override any of the standard images within Moodle from within your theme. At this point we will look at both how to make use of your own images within your theme, and secondly how to override the images being used by Moodle.&lt;br /&gt;
So first up a bit about images within Moodle,&lt;br /&gt;
&lt;br /&gt;
# Images you want to use within your theme &#039;&#039;&#039;need&#039;&#039;&#039; to be located within your theme&#039;s pix directory.&lt;br /&gt;
# You can use sub directories within the pix directory of your theme.&lt;br /&gt;
# Images used by Moodle&#039;s core are located within the pix directory of Moodle.&lt;br /&gt;
# Modules, blocks and other plugins should also store their images within a pix directory.&lt;br /&gt;
&lt;br /&gt;
So making use of your own images first up. Lets assume you have added two image files to the pix directory of your theme.&lt;br /&gt;
&lt;br /&gt;
* /theme/yourthemename/pix/imageone.jpg&lt;br /&gt;
* /theme/yourthemename/pix/subdir/imagetwo.png&lt;br /&gt;
&lt;br /&gt;
Notice that one image is a JPEG image, and the second is a PNG. Also the second image is in a subdirectory.&lt;br /&gt;
&lt;br /&gt;
The following code snippet illustrates how to make use of your images within HTML, such as if you wanted to use them within a layout file.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;imageone&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;subdir/imagetwo&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT&#039;&#039;&#039; include the image file extension. Moodle will work it out automatically and it will not work if you do include it.&lt;br /&gt;
&lt;br /&gt;
In this case rather than writing out the URL to the image we use a method of Moodle&#039;s output library. Its not too important how that functions works but it is important that we use it as it is what allows images within Moodle to be over-rideable.&lt;br /&gt;
&lt;br /&gt;
The following is how you would use the images from within CSS as background images.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.divone {&lt;br /&gt;
    background-image: url([[pix:theme|imageone]]);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.divtwo {&lt;br /&gt;
    background-image: url([[pix:theme|subdir/imagetwo]]);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If this case we have to use some special notations that Moodle looks for. Whenever Moodle hands out a CSS file it first searches for all &#039;&#039;[[something]]&#039;&#039; tags and replaces them with what is required.&lt;br /&gt;
&lt;br /&gt;
The final thing to notice with both of the cases above is that at no point do we include the images file extension. &lt;br /&gt;
The reason for this leads us into the next topic, how to override images.&lt;br /&gt;
&lt;br /&gt;
From within a theme you can VERY easily override any standard image within Moodle by simply adding the replacement image to the theme&#039;s pix directory in the same sub directory structure as it is in Moodle.&lt;br /&gt;
So for instance we wanted to override the following two images:&lt;br /&gt;
# /pix/moodlelogo.gif&lt;br /&gt;
# /pix/i/user.gif&lt;br /&gt;
We would simply need to add our replacement images to the theme in the following locations&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.gif&lt;br /&gt;
# /theme/themename/pix_core/i/user.gif&lt;br /&gt;
&#039;&#039;Note that we have created a &#039;&#039;&#039;pix_core&#039;&#039;&#039; directory in our theme. For module images we need a &#039;&#039;&#039;pix_mod&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Now the other very cool thing to mention is that Moodle looks for not just replacements of the same image type (jpg, gif, etc...) but also replacements in any image format. This is why above when working with our images we never specified the images file extension.&lt;br /&gt;
This means that the following would also work:&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.png&lt;br /&gt;
# /theme/themename/pix_core/i/user.bmp&lt;br /&gt;
&lt;br /&gt;
For a more detailed description of how this all works see the page on [[Using images in a theme]].&lt;br /&gt;
&lt;br /&gt;
==Adding custom fonts==&lt;br /&gt;
{{Moodle 2.6}}&lt;br /&gt;
&lt;br /&gt;
CSS3 standard introduced the possibility to specify custom fonts, see [http://www.w3schools.com/css3/css3_fonts.asp CSS3 Fonts tutorial].&lt;br /&gt;
&lt;br /&gt;
Since 2.6 Moodle includes support for plugin or theme fonts. It is very similar to theme images and pix subdirectories.&lt;br /&gt;
&lt;br /&gt;
===Font file locations===&lt;br /&gt;
&lt;br /&gt;
Depending on where you intend to use the font put it into one of the following locations:&lt;br /&gt;
* /lib/fonts/ - fonts used in core&lt;br /&gt;
* /plugindir/fonts/ - fonts used by plugin&lt;br /&gt;
* /theme/sometheme/fonts/ - theme specific fonts&lt;br /&gt;
&lt;br /&gt;
You can also override core and plugin fonts in theme:&lt;br /&gt;
* /theme/sometheme/fonts_core/ - overridden core fonts&lt;br /&gt;
* /theme/sometheme/fonts_plugins/plugintype_pluginname/ - overridden fonts of some plugin&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* subdirectories are not allowed&lt;br /&gt;
* use only lowercase alphanumeric characters and underscore in font file names&lt;br /&gt;
* WOFF (Web Open Font Format), TTF (True Type Fonts), OTF (OpenType Fonts), SVG (Scalable Vector Graphic) and EOT (Embedded OpenType) fonts are supported, but for the sake of humanity (And [https://tracker.moodle.org/browse/MDL-15169 MDL_15169] ) please use only WOFF fonts to encourage the quick death of IE8.&lt;br /&gt;
&lt;br /&gt;
===CSS placeholders===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
    font-family: ThreeDumb;&lt;br /&gt;
    src: url([[font:mod_book|3dumb.woff]]);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The placeholder references file /mod/book/fonts/3dumb.woff, the new fontface could be for example used for book headings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.path-mod-book .book_chapter_title {&lt;br /&gt;
    font-family: ThreeDumb;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you want to use some font in theme only, you can for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
    font-family: goodDogFont;&lt;br /&gt;
    src: url([[font:theme|good_dog.woff]]);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
a {font-family:goodDogFont;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The font would be stored in /theme/yourtheme/fonts/good_dog.woff file.&lt;br /&gt;
&lt;br /&gt;
===More free fonts===&lt;br /&gt;
&lt;br /&gt;
Please respect all licenses for font redistribution, you can get some nice free fonts from [http://www.fontsquirrel.com http://www.fontsquirrel.com] for example.&lt;br /&gt;
&lt;br /&gt;
===Warning===&lt;br /&gt;
&lt;br /&gt;
This is not intended for forcing of something like Comic Sans on all your visitors...&lt;br /&gt;
&lt;br /&gt;
==Unobvious Things==&lt;br /&gt;
===Getting Your Theme to Appear Correctly in Theme Selector===&lt;br /&gt;
If you follow the examples on this page to the letter, when you go to the Theme Selector page you may be discouraged to find that your theme does not appear like the other themes do. In fact, instead of your theme&#039;s name, you will see something along the lines of &amp;lt;nowiki&amp;gt;[[pluginname]]&amp;lt;/nowiki&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
To correct this, you must add the theme/THEMENAME/lang/en/theme_THEMENAME.php file, where THEMENAME is the name of the theme folder. Inside that file, add the string &amp;quot;$string[&#039;pluginname&#039;] = &#039;THEMENAME&#039;; &amp;quot;. Make THEMENAME the name of your theme, however you want it displayed in the Theme selector.&lt;br /&gt;
&lt;br /&gt;
Also, make sure to change your config.php file and version.php file to reflect the correct name:&lt;br /&gt;
&lt;br /&gt;
In config.php: $THEME-&amp;gt;name = &#039;NAME&#039;;&lt;br /&gt;
&lt;br /&gt;
In version.php: $plugin-&amp;gt;component = &#039;theme_NAME&#039;; // Full name of the plugin (used for diagnostics)&lt;br /&gt;
&lt;br /&gt;
The screenshot for the theme should be about 500x400 px.&lt;br /&gt;
&lt;br /&gt;
===Required theme divs===&lt;br /&gt;
&lt;br /&gt;
Some parts of Moodle may rely on particular divs, for example the div with id &#039;page-header&#039;.&lt;br /&gt;
&lt;br /&gt;
Consequently all themes must include at least the divs (with the same ids) that are present in the &#039;base&#039; theme. &lt;br /&gt;
&lt;br /&gt;
Missing out these elements may result in unexpected behaviour within specific modules or other plugins.&lt;br /&gt;
&lt;br /&gt;
==Appendix A==&lt;br /&gt;
===Theme options as of 17th April 2013===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_options_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting&lt;br /&gt;
! Effect&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;csspostprocess&#039;&#039;&#039;&lt;br /&gt;
|  Allows the user to provide the name of a function that all CSS should be passed to before being delivered.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;editor_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include within the body of the editor.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;enable_dock&#039;&#039;&#039;&lt;br /&gt;
|  If set to true the side dock is enabled for blocks&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;hidefromselector&#039;&#039;&#039;&lt;br /&gt;
| Used to hide a theme from the theme selector (unless theme designer mode is on). Accepts true or false.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;filter_mediaplugin_colors&#039;&#039;&#039;&lt;br /&gt;
|  Used to control the colours used in the small media player for the filters&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array containing the names of JavaScript files located in /javascript/ to include in the theme. (gets included in the head)&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts_footer&#039;&#039;&#039;&lt;br /&gt;
|  As above but will be included in the page footer.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;larrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the left arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;layouts&#039;&#039;&#039;&lt;br /&gt;
|  An array setting the layouts for the theme&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;name&#039;&#039;&#039;&lt;br /&gt;
| Name of the theme. Most likely the name of the directory in which this file resides.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents&#039;&#039;&#039;&lt;br /&gt;
|  An array of themes to inherit from&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array of JavaScript files NOT to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets not to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;plugins_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of plugin sheets to ignore and not include.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;rarrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the right arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;renderfactory&#039;&#039;&#039;&lt;br /&gt;
|  Sets a custom render factory to use with the theme, used when working with custom renderers.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;resource_mp3player_colors&#039;&#039;&#039;&lt;br /&gt;
|  Controls the colours for the MP3 player&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include for this theme. Should be located in the theme&#039;s style directory.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;supportscssoptimisation&#039;&#039;&#039;&lt;br /&gt;
|  When set to &#039;FALSE&#039; then the theme will not be affected by the &#039;CSS Optimiser&#039;.  The &#039;CSS Optimiser&#039; is enabled in Development &amp;gt; Experimental &amp;gt; Experimental settings.  When it is enabled CSS will be run through an optimisation process before being cached. The optimiser processes the CSS removing duplicate rules and styles, as well as white space removable and reformatting. Please note turning this on at the same time as theme designer mode is awful for performance but will help theme designers create optimised CSS.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===The different layouts as of 21st April 2013===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_layouts_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Layout&lt;br /&gt;
! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| base&lt;br /&gt;
| Most backwards compatible layout without the blocks - this is the layout used by default.&lt;br /&gt;
|- &lt;br /&gt;
| standard&lt;br /&gt;
| Standard layout with blocks, this is recommended for most pages with general information.&lt;br /&gt;
|- &lt;br /&gt;
| course&lt;br /&gt;
| Main course page.&lt;br /&gt;
|- &lt;br /&gt;
| coursecategory&lt;br /&gt;
| Use for browsing through course categories.&lt;br /&gt;
|- &lt;br /&gt;
| incourse&lt;br /&gt;
| Default layout while browsing a course, typical for modules.&lt;br /&gt;
|- &lt;br /&gt;
| frontpage&lt;br /&gt;
| The site home page.&lt;br /&gt;
|- &lt;br /&gt;
| admin&lt;br /&gt;
| Administration pages and scripts.&lt;br /&gt;
|- &lt;br /&gt;
| mydashboard&lt;br /&gt;
| My dashboard page.&lt;br /&gt;
|- &lt;br /&gt;
| mypublic&lt;br /&gt;
| My public page.&lt;br /&gt;
|- &lt;br /&gt;
| login&lt;br /&gt;
| The login page.&lt;br /&gt;
|-&lt;br /&gt;
| popup&lt;br /&gt;
| Pages that appear in pop-up windows - no navigation, no blocks, no header.&lt;br /&gt;
|-&lt;br /&gt;
| frametop&lt;br /&gt;
| Used for legacy frame layouts only. No blocks and minimal footer.&lt;br /&gt;
|-&lt;br /&gt;
| embedded&lt;br /&gt;
| Used for embedded pages, like iframe/object embedded in moodleform - it needs as much space as possible&lt;br /&gt;
|-&lt;br /&gt;
| maintenance&lt;br /&gt;
| Used during upgrade and install. This must not have any blocks, and it is a good idea if it does not have links to other places - for example there should not be a home link in the footer.&lt;br /&gt;
|-&lt;br /&gt;
| print&lt;br /&gt;
| Used when the page is being displayed specifically for printing.&lt;br /&gt;
|-&lt;br /&gt;
| redirect&lt;br /&gt;
| Used when a redirection is occurring&lt;br /&gt;
|-&lt;br /&gt;
| report&lt;br /&gt;
| Used for reports.&lt;br /&gt;
|-&lt;br /&gt;
| secure&lt;br /&gt;
| Used for safebrowser and securewindow.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Theme changes in 2.0]]&lt;br /&gt;
* [[Adding courses and categories to the custom menu]] &lt;br /&gt;
* [[Making a horizontal dock]]&lt;br /&gt;
* [[Adding theme upgrade code]]&lt;br /&gt;
* [[Styling and customising the dock]] &lt;br /&gt;
* [[Changing topic or weekly outline to Page heading]]&lt;br /&gt;
* [[jQuery]]&lt;br /&gt;
&lt;br /&gt;
===Moodle 2.2+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.2 how to clone a Moodle 2.2 theme]]&lt;br /&gt;
&lt;br /&gt;
===Moodle Bootstrap Themes - Moodle 2.5+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.5 How to copy and customise the Simple (bootstrap) theme]]&lt;br /&gt;
&lt;br /&gt;
[[de:Designs 2.0]]&lt;br /&gt;
[[es:Temas 2.0]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=44315</id>
		<title>Themes overview</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=44315"/>
		<updated>2014-04-06T18:57:01Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Files and folders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}Welcome to the new world of themes in Moodle 2.x!&lt;br /&gt;
&lt;br /&gt;
A Moodle theme allows the user to change the look and feel of a Moodle site.  Themes can be applied on the site, category, course and activity levels by users with permissions to do so.  Themes can be designed for specific devices such as mobile phones or tablets. This page explains how themes work in Moodle and is intended to help you create or modify most themes for Moodle 2.0&lt;br /&gt;
&lt;br /&gt;
You can use contributed themes or create your entire own to share with the community. Themes can also be based on parent themes with only few customizations. Themes accomplish this using CSS, changing the underlying markup structure and also adding Javascript to add more advanced behaviors.&lt;br /&gt;
&lt;br /&gt;
Most theme developers simply add a few changes to their new theme by basing it on an existing one. The Moodle Theme architecture is designed in such a way whereby the base theme will act as a fall-back that is used when nothing has been defined in the theme based on it. This makes it easy to create new themes that simply seek out to make minor changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.6==&lt;br /&gt;
{{Moodle 2.6}}&lt;br /&gt;
&lt;br /&gt;
===Fonts===&lt;br /&gt;
&lt;br /&gt;
CSS3 fonts can be now used in plugins, core and moodle themes. It is very similar to images in pix subdirectories (MDL-23493).&lt;br /&gt;
&lt;br /&gt;
===Chat Activity===&lt;br /&gt;
The Chat room window is now also styled via bootstrapbase. Themes based on bootstrapbase can now directly style or use &#039;customcss&#039; to style the chat window now. (MDL-42711)&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.5==&lt;br /&gt;
{{Moodle 2.5}}&lt;br /&gt;
&lt;br /&gt;
There is a new Bootstrap base theme. See [[Clean theme]] for more information.&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.4==&lt;br /&gt;
{{Moodle 2.4}}&lt;br /&gt;
&lt;br /&gt;
===HTML 5 doctype===&lt;br /&gt;
&lt;br /&gt;
By default Moodle is sending HTML5 doctype. Themes designers may decide to force old xhtml strict mode, but it is strongly discouraged and the site will not pass strictness validation. (MDL-34299)&lt;br /&gt;
&lt;br /&gt;
===Internet Explorer standards mode===&lt;br /&gt;
&lt;br /&gt;
Since 2.4 Moodle automatically sends X-UA-Compatible edge header, this should prevent Internet Explorer from switching to quirks or compatibility modes (MDL-36524). There is also a new workaround for intranet servers which previously identified recent IE browsers as IE7. (MDL-36481)&lt;br /&gt;
&lt;br /&gt;
===SVG icons===&lt;br /&gt;
&lt;br /&gt;
Most modern browsers support SVG icons. The benefit is that SVG scales perfectly to any screen resolution or zoom. It is now possible to add icons in SVG format to pix directories, Moodle uses SVG in supported browsers and PNG in legacy browsers. (MDL-22955)&lt;br /&gt;
&lt;br /&gt;
Please note that IE9 does not handle scaling of standard SVG icons properly, you may have to manually execute a special script from theme/base/cli/svgtool.php to alter the icons to be compatible with buggy IE9. (MDL-36436)&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.0==&lt;br /&gt;
&lt;br /&gt;
The theme system was completely redesigned in Moodle 2.0.  Known issues have been addressed and new features have been added to meet community requests.&lt;br /&gt;
&lt;br /&gt;
Unfortunately it was not possible to maintain backward compatibility, so all Moodle 1.x themes need to be recreated for Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
Major changes include:&lt;br /&gt;
* Clearer and more consistent CSS classes and IDs throughout all pages in Moodle&lt;br /&gt;
* Introduction of layout files (templates) describing overall layout HTML for many different types of pages in Moodle.&lt;br /&gt;
* Introduction of renderers, which produce the smaller &amp;quot;parts&amp;quot; of a HTML page.  Advanced themes can choose to override these too if they choose.&lt;br /&gt;
* Introduction of standard methods for adding Javascript to themes.&lt;br /&gt;
* Easier control over icons and images in Moodle.&lt;br /&gt;
* The old &amp;quot;standard&amp;quot; theme has been split into two themes:&lt;br /&gt;
**&#039;&#039;&#039;base&#039;&#039;&#039; - contains absolutely basic layout, and&lt;br /&gt;
**&#039;&#039;&#039;standard&#039;&#039;&#039; - which adds CSS to the base theme to make it look like the old standard theme.&lt;br /&gt;
* Performance tuning: In normal production mode CSS files are combined into a single optimised file, and both CSS and JavaScript files are minimised to ensure there are no wasted connections or traffic.  Files are heavily cached, but also versioned, so that users never need to clear their caches.&lt;br /&gt;
&lt;br /&gt;
==The structure of a theme==&lt;br /&gt;
&lt;br /&gt;
Some important things to know when building good themes:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;config.php&#039;&#039;&#039; - this file is required in every theme.  It defines configuration settings and definitions required to make the theme work in Moodle. These include theme, file, region, default region and options. &lt;br /&gt;
# &#039;&#039;&#039;Layouts and layout files&#039;&#039;&#039; -  in config.php there is one definition for each page type (see [[#theme_layouts_table|Appendix A: Theme layouts]] for a list of over 12 types).  Each page type definition tells Moodle which layout file will be used, what block regions this page type should display and so on.  The layout file contains the HTML and the minimum PHP required to display basic structure of pages. (If you know Moodle 1.9, it&#039;s like a combination of header.html and footer.html).&lt;br /&gt;
# &#039;&#039;&#039;The base theme&#039;&#039;&#039; - is not intended to be used for production sites.  It sets up the simplest possible generic layout and includes only CSS essential to that layout &#039;&#039;or&#039;&#039; to Moodle as a whole.  It tries not to make any unnecessary rules and makes as few assumptions as possible.  It&#039;s the perfect base on which to start designing a theme, as there are very few colours, borders, margins, and alignments to override.  You can just start adding what you need.&lt;br /&gt;
&lt;br /&gt;
===Files and folders===&lt;br /&gt;
A theme&#039;s files are placed in a folder with under moodle/theme folder and have subfolders. They are laid out like this:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Directory&lt;br /&gt;
! File&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| config.php&lt;br /&gt;
| Contains all of the configuration and definitions for each theme&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| lib.php &lt;br /&gt;
| Contains speciality classes and functions that are used by theme&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| renderers.php &lt;br /&gt;
| Contains any custom renderers for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| settings.php &lt;br /&gt;
| Contains custom theme settings. These local settings are defined by the theme allowing the theme user to easily alter something about the way it looks or operates. (eg a background colour, or a header image)&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| version.php &lt;br /&gt;
| Contains the theme name, version number and Moodle version requirements for using the theme&lt;br /&gt;
|-&lt;br /&gt;
| /fonts/&lt;br /&gt;
| *.woff, *.ttf, *.eot, *.svg, *.otf&lt;br /&gt;
| Theme fonts (since 2.6).&lt;br /&gt;
|-&lt;br /&gt;
| /fonts_core/ &lt;br /&gt;
| *.woff, *.ttf, *.eot, *.svg, *.otf&lt;br /&gt;
| Contains fonts that override standard core fonts (since 2.6).&lt;br /&gt;
|-&lt;br /&gt;
| /fonts_plugins/plugintype/pluginname/ &lt;br /&gt;
| *.woff, *.ttf, *.eot, *.svg, *.otf&lt;br /&gt;
| Contains fonts that override plugin fonts (since 2.6).&lt;br /&gt;
|-&lt;br /&gt;
| /javascript/ &lt;br /&gt;
| *.js&lt;br /&gt;
| All specialty JavaScript files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /lang/ &lt;br /&gt;
| &lt;br /&gt;
| Any special language files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /layout/ &lt;br /&gt;
| *.php&lt;br /&gt;
| Contains the layout files for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/ &lt;br /&gt;
| *.png, *.jpg, *.gif, *.svg&lt;br /&gt;
| Contains any images the theme makes use of either in CSS or in the layout files.&lt;br /&gt;
|-&lt;br /&gt;
|  /pix/&lt;br /&gt;
| favicon.ico &lt;br /&gt;
| The favicon to display for this theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/&lt;br /&gt;
| screenshot.png &lt;br /&gt;
| A screenshot of the theme to be displayed in on the theme selection screen.&lt;br /&gt;
|-&lt;br /&gt;
| /pix_core/ &lt;br /&gt;
| *.png, *.jpg, *.gif, *.svg&lt;br /&gt;
| Contains images that override standard core images.&lt;br /&gt;
|-&lt;br /&gt;
| /pix_plugins/plugintype/pluginname/ &lt;br /&gt;
| *.png, *.jpg, *.gif, *.svg&lt;br /&gt;
| Contains images that override plugin images.&lt;br /&gt;
|-&lt;br /&gt;
| /style/&lt;br /&gt;
| *.css&lt;br /&gt;
| Default location for CSS files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are also several other places that stylesheets can be included from (see the CSS how and why section below).&lt;br /&gt;
&lt;br /&gt;
It is possible to override icons used in base themes without interfering with core code by placing these in dataroot/pix and dataroot/pix_plugins. Where a theme extends a base theme and provides its own icons, these icons will still be used.&lt;br /&gt;
&lt;br /&gt;
==Theme options==&lt;br /&gt;
All theme options are set within the config.php file for the theme.  The settings that are most used are: parents, sheets, layouts, and javascripts. Have a look at the &#039;&#039;&#039;[[#theme_options_table|theme options table]]&#039;&#039;&#039; for a complete list of theme options which include lesser used specialised or advanced settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Basic theme config example===&lt;br /&gt;
Lets have a look at a basic theme configuration file and the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;newtheme&#039;;&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;parents = array(&lt;br /&gt;
    &#039;base&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;admin&#039;,&lt;br /&gt;
    &#039;blocks&#039;,&lt;br /&gt;
    &#039;calendar&#039;,&lt;br /&gt;
    &#039;course&#039;,&lt;br /&gt;
    &#039;grade&#039;,&lt;br /&gt;
    &#039;message&#039;,&lt;br /&gt;
    &#039;question&#039;,&lt;br /&gt;
    &#039;user&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    )&lt;br /&gt;
    //.......&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;javascripts_footer = array(&lt;br /&gt;
    &#039;navigation&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic theme example settings explained===&lt;br /&gt;
First up you will notice everything is added to $THEME. This is the theme&#039;s configuration object, it is created by Moodle using default settings and is then updated by whatever settings you add to it.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;name : The first setting, is the theme&#039;s name. This should simply be whatever your theme&#039;s name is, most likely whatever you named your theme directory.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;parents : This defines the themes that the theme will extend. In this case it is extending only the base theme.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;sheets : An array containing the names of the CSS stylesheets to include for this theme. Note that it is just the name of the stylesheet and does not contain the directory or the file extension. Moodle assumes that the theme&#039;s stylesheets will be located in the styles directory of the theme and have .css as an extension.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;layouts : In this example, two layouts have been defined to override the layouts from the base theme. For more information see the [[#Layouts|layouts]] section below.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;javascripts_footer : The final setting is to include a JavaScript file. Much like stylesheets, you only need to provide the files name. Moodle will assume it is in your themes JavaScript directory and be a .js file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: When you first begin writing themes, make sure you take a look at the configuration files of the other themes that get shipped with Moodle. You will get a good picture of how everything works, and what is going on in a theme, simply by reading it and taking notice of what it is including or excluding.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
===Locations of CSS files===&lt;br /&gt;
First lets look at where CSS can be included from within Moodle:&lt;br /&gt;
; \theme\themename\style\*.css : This is the default location for all of the stylesheets that are used by a theme and the place which should be used by a theme designer.&lt;br /&gt;
&lt;br /&gt;
New theme developers should note that the order in which CSS files are found and included creates a hierarchy.  This order ensures that the rules, within a theme&#039;s style sheets, take precedence over identical rules in other files that may have been introduced before.  This can both extend another files definitions (see parent array in the config file) and also ensures that the current theme&#039;s CSS rules/definitions have the last say.&lt;br /&gt;
&lt;br /&gt;
There are other locations that can be used (although very rarely) to include CSS in a page. A developer of a php file can manually specify a stylesheet from anywhere within Moodle, like the database. Usually, if code is doing this, it is because there is a non-theme config or plugin setting that contains information requires special CSS information.  As a theme designer you should be aware of, but not have to worry about, these locations of CSS files.  Here are some examples:&lt;br /&gt;
&lt;br /&gt;
; {pluginpath}\styles.css e.g. \block\blockname\styles.css or \mod\modname\styles.css : Every plugin can have its own styles.css file. This file should only contain the required CSS rules for the module and should not add anything to the look of the plugin such as colours, font sizes, or margins other than those that are truly required.&amp;lt;br /&amp;gt;Theme specific styles for a plugin should be located within the themes styles directory.&lt;br /&gt;
; {pluginpath}\styles_themename.css : This should only ever be used by plugin developers. It allows them to write CSS that is designed for a specific theme without having to make changes to that theme. You will notice that this is never used within Moodle and is designed to be used only by contributed code.&lt;br /&gt;
&lt;br /&gt;
As theme designers, we will only use the first method of introducing CSS: adding rules to a stylesheet file located in the theme&#039;s style directory.&lt;br /&gt;
&lt;br /&gt;
===Moodle&#039;s core CSS organisation===&lt;br /&gt;
The next thing to look at is the organisation of CSS and rules within a theme. Although as a theme designer it is entirely up to you as to how you create and organise your CSS. Please note that within the themes provided in the standard install by Moodle there is a very clear organisation of CSS.&lt;br /&gt;
&lt;br /&gt;
First is the  pagelayout.css file. This contains the CSS required to give the layouts their look and feel.  It doesn&#039;t contain any rules that affect the content generated by Moodle.&lt;br /&gt;
&lt;br /&gt;
Next is the core.css file. If you open up core you will notice that it contains all manner of general (usually simple) rules that don&#039;t relate to a specific section of Moodle but to Moodle as a whole.&lt;br /&gt;
&lt;br /&gt;
There can also be rules that relate to specific sections.  However, this is done only when there are only a handful of rules for that section. These small clusters of rules are grouped together and separated by comments identifying for which section each relates.&lt;br /&gt;
&lt;br /&gt;
Finally there are all the other CSS files, you will notice that there is a file for each section of Moodle that has a significant collection of rules.&lt;br /&gt;
&lt;br /&gt;
:For those who are familiar with Moodle 1.9 theme&#039;s, this organisation will be a big change. In 1.9, CSS was organised by its nature (for example: colours, layout, other).&lt;br /&gt;
&lt;br /&gt;
===How to write effective CSS rules within Moodle===&lt;br /&gt;
In Moodle 2.0, writing good CSS rules is incredibly important.&lt;br /&gt;
&lt;br /&gt;
Due to performance requirements and browser limitations, all of the CSS files are combined into a single CSS file that gets included every time. This means that rules need to be written in such a way as to minimise the chances of a collision leading to unwanted styles being applied. Whilst writing good CSS is something most designers strive for we have implemented several new body classes and prompt developers to use appropriate classnames.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;body&amp;gt; CSS id and classes ====&lt;br /&gt;
As of Moodle 2.0 the ID tag that gets applied to the body will always be a representation of the URI. For example if you are looking at a forum posting and the URI is &#039;/mod/forum/view.php&#039; then the body tags ID will be &#039;#page-mod-forum-view&#039;.&lt;br /&gt;
&lt;br /&gt;
As well as the body&#039;s ID attribute the URI is also exploded to form several CSS classes that get added to the body tag, so in the above example &#039;/mod/forum/view&#039; you would end up with the following classes being added to the body tag &#039;.path-mod&#039;, &#039;.path-mod-forum&#039;. Note that &#039;.path-mod-forum-view&#039; is not added as a class, this is intentionally left out to lessen confusion and duplication as rules can relate directly to the page by using the ID and do not require the final class.&lt;br /&gt;
&lt;br /&gt;
The body ID and body classes described above will form the bread and butter for many of the CSS rules you will need to write for your theme, however there are also several other very handy classes that get added to the body tag that will be beneficial to you once you start your journey down the rabbit hole that is themeing. Some of the more interesting classes are listed below.&lt;br /&gt;
&lt;br /&gt;
* If JavaScript is enabled then &#039;jsenabled&#039; will be added as a class to the body tag allowing you to style based on JavaScript being enabled or not.&lt;br /&gt;
* Either &#039;dir-rtl&#039; or &#039;dir-ltr&#039; will be added to the body as a class depending on the direction of the language pack: rtl = right to left, ltr = left to right. This allows you to determine your text-alignment based on language if required.&lt;br /&gt;
* A class will be added to represent the language pack currently in use, by default en_utf8 is used by Moodle and will result in the class &#039;lang-en_utf8&#039; being added to the body tag.&lt;br /&gt;
* The wwwroot for Moodle will also be converted to a class and added to the body tag allowing you to stylise your theme based on the URL through which it was reached. e.g. http://sam.moodle.local/moodle/ will become &#039;.sam-moodle-local—moodle&#039;&lt;br /&gt;
* If the current user is not logged then &#039;.notloggedin&#039; will be added to the body tag.&lt;br /&gt;
&lt;br /&gt;
What does all of this look like in practise? Well using the above example /mod/forum/view.php you would get at least the following body tag:&lt;br /&gt;
&amp;lt;code html4strict&amp;gt;&amp;lt;body id=”page-mod-forum-view” class=”path-mod path-mod-forum” /&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Writing your rules====&lt;br /&gt;
&lt;br /&gt;
By following the [[CSS coding style]] and CSS best-practices and understanding the [http://htmlhelp.com/reference/css/structure.html#cascade cascading order] of CSS a theme developer will reduce collisions and lines of CSS that is written. CSS classes have been placed where it is believed anyone may want to apply their own styles.&lt;br /&gt;
&lt;br /&gt;
When starting to write rules make sure that you have a good understanding of where you want those rules to be applied, it is a good idea to make the most of the body classes mentioned above.&lt;br /&gt;
If you want to write a rule for a specific page make use of the body tag&#039;s ID, e.g.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;#page-mod-forum-view .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to write a rule that will be applied all throughout the forum.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;.path-mod-forum .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The other very important thing to take into consideration is the structure leading up to the tag you want to style. Browsers apply conflicting styles with priority on the more specific selectors. It can be very beneficial to keep this in mind and write full selectors that rely on the structure of the tags leading to the tag you wish to style.&lt;br /&gt;
&lt;br /&gt;
By making use of body id&#039;s and classes and writing selectors to take into account the leading structure you can greatly minimise the chance of a collision both with Moodle now and in the future.&lt;br /&gt;
&lt;br /&gt;
==Layouts==&lt;br /&gt;
Layouts are defined in &#039;&#039;&#039;config.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
All themes are required to define the layouts they wish to be responsible for as well as create; however, many layout files are required by those layouts. If the theme is overriding another theme then it is a case of deciding which layouts this new theme should override. If the theme is a completely fresh start then you will need to define a layout for each of the different possibilities. &lt;br /&gt;
&lt;br /&gt;
It is also important to note that a new theme that will base itself on another theme (overriding it) does not need to define any layouts or use any layout files if there are no changes that it wishes to make to the layouts of the existing theme. The standard theme in Moodle is a good example of this as it extends the base theme simply adding CSS to achieve its look and feel.&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, layouts are defined in config.php within $THEME-&amp;gt;layouts. The following is an example of one such layout definition:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    // Standard layout with blocks, this is recommended for most pages with general information&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;base&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;&lt;br /&gt;
    )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The first thing Moodle looks at is the name of the layout, in this case it is `standard` (the array key in PHP), it then looks at the settings for the layout, this is the theme, file, regions, and default region. There are also a couple of other options that can be set by a layout.&lt;br /&gt;
&lt;br /&gt;
; theme : is the theme the layout file exists in. That&#039;s right: you can make use of layouts from other installed themes. &#039;&#039;Optional&#039;&#039;&lt;br /&gt;
; file : is the name of the layout file this layout wants to use. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; regions : is the different block regions (places you can put blocks) within the theme. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; defaultregion : is the default location when adding new blocks. &#039;&#039;&#039;Required if regions is non-empty, otherwise optional&#039;&#039;&#039;&lt;br /&gt;
; options : an array of layout specific options described in detail below. &#039;&#039;&#039;Optional&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;theme&#039;&#039;&#039; is optional. Normally the the layout file is looked for in the current theme, or, if it is not there, in the parent theme. However, you can use a layout file from any other theme by giving the theme name here.&lt;br /&gt;
&lt;br /&gt;
You can define whatever regions you like. You just need to pick a name for each one. Most themes just use one or both of &#039;&#039;&#039;side_pre&#039;&#039;&#039; and &#039;&#039;&#039;side_post&#039;&#039;&#039;, which is like &#039;left side&#039; and &#039;right side&#039;, except in right to left languages, when they are reversed. If you say in config.php that your the layout provides regions called &#039;fred&#039; and &#039;barney&#039;, then you must call $OUTPUT-&amp;gt;blocks_for_region(&#039;fred&#039;) and $OUTPUT-&amp;gt;blocks_for_region(&#039;barney&#039;) somewhere in the layout file.&lt;br /&gt;
&lt;br /&gt;
The final setting &#039;&#039;&#039;options&#039;&#039;&#039; is a special case that only needs to be set if you want to make use of it. This setting allows the theme designer to specify special options that they would like to create that can be later accessed within the layout file. This allows the theme to make design decisions during the definition and react upon those decisions in what ever layout file is being used.&lt;br /&gt;
&lt;br /&gt;
One such place this has been used is within the base theme. If you take a look first at theme/base/config.php you will notice that several layouts specify options &#039;&#039;&#039;nonavbar&#039;&#039;&#039; and &#039;&#039;&#039;nofooter&#039;&#039;&#039; which can both be set to either true or false. Then if we take a look at theme/base/layout/general.php you will spot lines like the following:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hasnavbar = (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar());&lt;br /&gt;
$hasfooter = (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;]));&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
............&lt;br /&gt;
&amp;lt;?php if ($hasnavbar) { ?&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
What you are seeing here is the use of those settings from the layout within the layout file. In this case it is being used to toggle the display of the navigation bar and page footer.&lt;br /&gt;
&lt;br /&gt;
==Layout files==&lt;br /&gt;
A layout file is a file that contains the core HTML structure for a layout including the header, footer, content and block regions. For those of you who are familiar with themes in Moodle 1.9 this is simply header.html and footer.html combined. Of course it is not all HTML, there are bits of HTML and content that Moodle needs to put into the page, within each layout file this will be done by a couple of simple PHP calls to get bits and pieces including content.&lt;br /&gt;
&lt;br /&gt;
Before learning more it is good to understand the two primary objects that will be used in your layout files: $OUTPUT and $PAGE.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$OUTPUT&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;core_renderer&amp;lt;/code&amp;gt; class which is defined in lib/outputrenderers.php. Each method is clearly documented there, along with which is appropriate for use within the layout files.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$PAGE&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;moodle_page&amp;lt;/code&amp;gt; class defined in lib/pagelib.php. Most of the things you will want to use are the properties that are all documented at the top of the file. If you are not familiar with PHP properties, you access them like $PAGE-&amp;gt;activityname, just like fields of an ordinary PHP object. (However, behind the scenes the value you get is produced by calling a function. Also, you cannot change these values, they are &#039;&#039;&#039;read-only&#039;&#039;&#039;. However, you don&#039;t need to understand all that if you are just using these properties in your theme.)&lt;br /&gt;
&lt;br /&gt;
The following is a very simple layout file to illustrate the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid) ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses) ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;table id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
            &amp;lt;?php&lt;br /&gt;
            echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
            ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We assume you know enough HTML to understand the basic structure above, but let&#039;s explain the PHP code since that is less obvious.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This occurs at the VERY top of the page, it must be the first bit of output and is responsible for adding the (X)HTML document type definition to the page. This of course is determined by the settings of the site and is one of the things that the theme designer has no control over.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we have started writing the opening html tag and have asked Moodle to give us the HTML attributes that should be applied to it. This again is determined by several settings within the actual HTML install.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This gets us the title for the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This very important call gets us the standard head HTML that needs to be within the HEAD tag of the page. This is where CSS and JavaScript requirements for the top of the page will be output as well as any special script or style tags.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid); ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses); ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Much like the html tag above we have started writing the body tag and have asked for Moodle to get us the desired ID and classes that should be applied to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading; ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are creating the header for the page. In this case we want the heading for the page, we want to display the login information which will be the current users username or a link to log in if they are not logged in, and we want the heading menu if there is one.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-pre&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is one of the most important calls within the file, it determines where the actual content for the page gets inserted.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-post&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This final bit of code gets the content for the footer of the page. It gets the login information which is the same as in the header, a home link, and the standard footer HTML which like the standard head HTML contains all of the script and style tags required by the page and requested to go in the footer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: Within Moodle 2.0 most of the JavaScript for the page will be included in the footer. This greatly helps reduce the loading time of the page.&lt;br /&gt;
&lt;br /&gt;
When writing layout files think about the different layouts and how the HTML that each makes use of will differ. You will most likely find you do not need a different layout file for each layout, most likely you will be able to reuse the layout files you create across several layouts. You can of course make use of layout options as well to further reduce the number of layout files you need to produce.&lt;br /&gt;
&lt;br /&gt;
Of course as mentioned above if you are customising an existing theme then you may not need to create any layouts or layout files at all.&lt;br /&gt;
&lt;br /&gt;
==Language File==&lt;br /&gt;
&lt;br /&gt;
You need to create a language file for your theme with a few standard strings in it. At a minimum create a file called lang/en/theme_themename.php in your theme folder. For example, the &#039;standard&#039; theme has a language file called lang/en/theme_standard.php. &lt;br /&gt;
&lt;br /&gt;
You &#039;&#039;&#039;must&#039;&#039;&#039; define the following lines in your file (example is from standard theme, adapt as required):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Standard&#039;;&lt;br /&gt;
$string[&#039;region-side-post&#039;] = &#039;Right&#039;;&lt;br /&gt;
$string[&#039;region-side-pre&#039;] = &#039;Left&#039;;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;This theme is a very basic white theme, with a minimum amount of &lt;br /&gt;
 CSS added to the base theme to make it actually usable.&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without the above you will get notices for the missing strings.&lt;br /&gt;
&lt;br /&gt;
==Making use of images==&lt;br /&gt;
Right at the start when listing the features of the new themes system one of the features mentioned was the ability to override any of the standard images within Moodle from within your theme. At this point we will look at both how to make use of your own images within your theme, and secondly how to override the images being used by Moodle.&lt;br /&gt;
So first up a bit about images within Moodle,&lt;br /&gt;
&lt;br /&gt;
# Images you want to use within your theme &#039;&#039;&#039;need&#039;&#039;&#039; to be located within your theme&#039;s pix directory.&lt;br /&gt;
# You can use sub directories within the pix directory of your theme.&lt;br /&gt;
# Images used by Moodle&#039;s core are located within the pix directory of Moodle.&lt;br /&gt;
# Modules, blocks and other plugins should also store their images within a pix directory.&lt;br /&gt;
&lt;br /&gt;
So making use of your own images first up. Lets assume you have added two image files to the pix directory of your theme.&lt;br /&gt;
&lt;br /&gt;
* /theme/yourthemename/pix/imageone.jpg&lt;br /&gt;
* /theme/yourthemename/pix/subdir/imagetwo.png&lt;br /&gt;
&lt;br /&gt;
Notice that one image is a JPEG image, and the second is a PNG. Also the second image is in a subdirectory.&lt;br /&gt;
&lt;br /&gt;
The following code snippet illustrates how to make use of your images within HTML, such as if you wanted to use them within a layout file.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;imageone&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;subdir/imagetwo&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT&#039;&#039;&#039; include the image file extension. Moodle will work it out automatically and it will not work if you do include it.&lt;br /&gt;
&lt;br /&gt;
In this case rather than writing out the URL to the image we use a method of Moodle&#039;s output library. Its not too important how that functions works but it is important that we use it as it is what allows images within Moodle to be over-rideable.&lt;br /&gt;
&lt;br /&gt;
The following is how you would use the images from within CSS as background images.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.divone {&lt;br /&gt;
    background-image: url([[pix:theme|imageone]]);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.divtwo {&lt;br /&gt;
    background-image: url([[pix:theme|subdir/imagetwo]]);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If this case we have to use some special notations that Moodle looks for. Whenever Moodle hands out a CSS file it first searches for all &#039;&#039;[[something]]&#039;&#039; tags and replaces them with what is required.&lt;br /&gt;
&lt;br /&gt;
The final thing to notice with both of the cases above is that at no point do we include the images file extension. &lt;br /&gt;
The reason for this leads us into the next topic, how to override images.&lt;br /&gt;
&lt;br /&gt;
From within a theme you can VERY easily override any standard image within Moodle by simply adding the replacement image to the theme&#039;s pix directory in the same sub directory structure as it is in Moodle.&lt;br /&gt;
So for instance we wanted to override the following two images:&lt;br /&gt;
# /pix/moodlelogo.gif&lt;br /&gt;
# /pix/i/user.gif&lt;br /&gt;
We would simply need to add our replacement images to the theme in the following locations&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.gif&lt;br /&gt;
# /theme/themename/pix_core/i/user.gif&lt;br /&gt;
&#039;&#039;Note that we have created a &#039;&#039;&#039;pix_core&#039;&#039;&#039; directory in our theme. For module images we need a &#039;&#039;&#039;pix_mod&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Now the other very cool thing to mention is that Moodle looks for not just replacements of the same image type (jpg, gif, etc...) but also replacements in any image format. This is why above when working with our images we never specified the images file extension.&lt;br /&gt;
This means that the following would also work:&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.png&lt;br /&gt;
# /theme/themename/pix_core/i/user.bmp&lt;br /&gt;
&lt;br /&gt;
For a more detailed description of how this all works see the page on [[Using images in a theme]].&lt;br /&gt;
&lt;br /&gt;
==Adding custom fonts==&lt;br /&gt;
{{Moodle 2.6}}&lt;br /&gt;
&lt;br /&gt;
CSS3 standard introduced the possibility to specify custom fonts, see [http://www.w3schools.com/css3/css3_fonts.asp CSS3 Fonts tutorial].&lt;br /&gt;
&lt;br /&gt;
Since 2.6 Moodle includes support for plugin or theme fonts. It is very similar to theme images and pix subdirectories.&lt;br /&gt;
&lt;br /&gt;
===Font file locations===&lt;br /&gt;
&lt;br /&gt;
Depending on where you intend to use the font put it into one of the following locations:&lt;br /&gt;
* /lib/fonts/ - fonts used in core&lt;br /&gt;
* /plugindir/fonts/ - fonts used by plugin&lt;br /&gt;
* /theme/sometheme/fonts/ - theme specific fonts&lt;br /&gt;
&lt;br /&gt;
You can also override core and plugin fonts in theme:&lt;br /&gt;
* /theme/sometheme/fonts_core/ - overridden core fonts&lt;br /&gt;
* /theme/sometheme/fonts_plugins/plugintype_pluginname/ - overridden fonts of some plugin&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* subdirectories are not allowed&lt;br /&gt;
* use only lowercase alphanumeric characters and underscore in font file names&lt;br /&gt;
* WOFF (Web Open Font Format), TTF (True Type Fonts), OTF (OpenType Fonts) and EOT (Embedded OpenType) fonts are supported, but for the sake of humanity (And [https://tracker.moodle.org/browse/MDL-15169 MDL_15169] ) please use only WOFF fonts to encourage the quick death of IE8.&lt;br /&gt;
&lt;br /&gt;
===CSS placeholders===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
    font-family: ThreeDumb;&lt;br /&gt;
    src: url([[font:mod_book|3dumb.woff]]);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The placeholder references file /mod/book/fonts/3dumb.woff, the new fontface could be for example used for book headings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.path-mod-book .book_chapter_title {&lt;br /&gt;
    font-family: ThreeDumb;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you want to use some font in theme only, you can for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
    font-family: goodDogFont;&lt;br /&gt;
    src: url([[font:theme|good_dog.woff]]);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
a {font-family:goodDogFont;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The font would be stored in /theme/yourtheme/fonts/good_dog.woff file.&lt;br /&gt;
&lt;br /&gt;
===More free fonts===&lt;br /&gt;
&lt;br /&gt;
Please respect all licenses for font redistribution, you can get some nice free fonts from [http://www.fontsquirrel.com http://www.fontsquirrel.com] for example.&lt;br /&gt;
&lt;br /&gt;
===Warning===&lt;br /&gt;
&lt;br /&gt;
This is not intended for forcing of something like Comic Sans on all your visitors...&lt;br /&gt;
&lt;br /&gt;
==Unobvious Things==&lt;br /&gt;
===Getting Your Theme to Appear Correctly in Theme Selector===&lt;br /&gt;
If you follow the examples on this page to the letter, when you go to the Theme Selector page you may be discouraged to find that your theme does not appear like the other themes do. In fact, instead of your theme&#039;s name, you will see something along the lines of &amp;lt;nowiki&amp;gt;[[pluginname]]&amp;lt;/nowiki&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
To correct this, you must add the theme/THEMENAME/lang/en/theme_THEMENAME.php file, where THEMENAME is the name of the theme folder. Inside that file, add the string &amp;quot;$string[&#039;pluginname&#039;] = &#039;THEMENAME&#039;; &amp;quot;. Make THEMENAME the name of your theme, however you want it displayed in the Theme selector.&lt;br /&gt;
&lt;br /&gt;
Also, make sure to change your config.php file and version.php file to reflect the correct name:&lt;br /&gt;
&lt;br /&gt;
In config.php: $THEME-&amp;gt;name = &#039;NAME&#039;;&lt;br /&gt;
&lt;br /&gt;
In version.php: $plugin-&amp;gt;component = &#039;theme_NAME&#039;; // Full name of the plugin (used for diagnostics)&lt;br /&gt;
&lt;br /&gt;
The screenshot for the theme should be about 500x400 px.&lt;br /&gt;
&lt;br /&gt;
===Required theme divs===&lt;br /&gt;
&lt;br /&gt;
Some parts of Moodle may rely on particular divs, for example the div with id &#039;page-header&#039;.&lt;br /&gt;
&lt;br /&gt;
Consequently all themes must include at least the divs (with the same ids) that are present in the &#039;base&#039; theme. &lt;br /&gt;
&lt;br /&gt;
Missing out these elements may result in unexpected behaviour within specific modules or other plugins.&lt;br /&gt;
&lt;br /&gt;
==Appendix A==&lt;br /&gt;
===Theme options as of 17th April 2013===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_options_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting&lt;br /&gt;
! Effect&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;csspostprocess&#039;&#039;&#039;&lt;br /&gt;
|  Allows the user to provide the name of a function that all CSS should be passed to before being delivered.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;editor_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include within the body of the editor.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;enable_dock&#039;&#039;&#039;&lt;br /&gt;
|  If set to true the side dock is enabled for blocks&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;hidefromselector&#039;&#039;&#039;&lt;br /&gt;
| Used to hide a theme from the theme selector (unless theme designer mode is on). Accepts true or false.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;filter_mediaplugin_colors&#039;&#039;&#039;&lt;br /&gt;
|  Used to control the colours used in the small media player for the filters&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array containing the names of JavaScript files located in /javascript/ to include in the theme. (gets included in the head)&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts_footer&#039;&#039;&#039;&lt;br /&gt;
|  As above but will be included in the page footer.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;larrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the left arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;layouts&#039;&#039;&#039;&lt;br /&gt;
|  An array setting the layouts for the theme&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;name&#039;&#039;&#039;&lt;br /&gt;
| Name of the theme. Most likely the name of the directory in which this file resides.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents&#039;&#039;&#039;&lt;br /&gt;
|  An array of themes to inherit from&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array of JavaScript files NOT to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets not to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;plugins_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of plugin sheets to ignore and not include.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;rarrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the right arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;renderfactory&#039;&#039;&#039;&lt;br /&gt;
|  Sets a custom render factory to use with the theme, used when working with custom renderers.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;resource_mp3player_colors&#039;&#039;&#039;&lt;br /&gt;
|  Controls the colours for the MP3 player&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include for this theme. Should be located in the theme&#039;s style directory.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;supportscssoptimisation&#039;&#039;&#039;&lt;br /&gt;
|  When set to &#039;FALSE&#039; then the theme will not be affected by the &#039;CSS Optimiser&#039;.  The &#039;CSS Optimiser&#039; is enabled in Development &amp;gt; Experimental &amp;gt; Experimental settings.  When it is enabled CSS will be run through an optimisation process before being cached. The optimiser processes the CSS removing duplicate rules and styles, as well as white space removable and reformatting. Please note turning this on at the same time as theme designer mode is awful for performance but will help theme designers create optimised CSS.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===The different layouts as of 21st April 2013===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_layouts_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Layout&lt;br /&gt;
! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| base&lt;br /&gt;
| Most backwards compatible layout without the blocks - this is the layout used by default.&lt;br /&gt;
|- &lt;br /&gt;
| standard&lt;br /&gt;
| Standard layout with blocks, this is recommended for most pages with general information.&lt;br /&gt;
|- &lt;br /&gt;
| course&lt;br /&gt;
| Main course page.&lt;br /&gt;
|- &lt;br /&gt;
| coursecategory&lt;br /&gt;
| Use for browsing through course categories.&lt;br /&gt;
|- &lt;br /&gt;
| incourse&lt;br /&gt;
| Default layout while browsing a course, typical for modules.&lt;br /&gt;
|- &lt;br /&gt;
| frontpage&lt;br /&gt;
| The site home page.&lt;br /&gt;
|- &lt;br /&gt;
| admin&lt;br /&gt;
| Administration pages and scripts.&lt;br /&gt;
|- &lt;br /&gt;
| mydashboard&lt;br /&gt;
| My dashboard page.&lt;br /&gt;
|- &lt;br /&gt;
| mypublic&lt;br /&gt;
| My public page.&lt;br /&gt;
|- &lt;br /&gt;
| login&lt;br /&gt;
| The login page.&lt;br /&gt;
|-&lt;br /&gt;
| popup&lt;br /&gt;
| Pages that appear in pop-up windows - no navigation, no blocks, no header.&lt;br /&gt;
|-&lt;br /&gt;
| frametop&lt;br /&gt;
| Used for legacy frame layouts only. No blocks and minimal footer.&lt;br /&gt;
|-&lt;br /&gt;
| embedded&lt;br /&gt;
| Used for embedded pages, like iframe/object embedded in moodleform - it needs as much space as possible&lt;br /&gt;
|-&lt;br /&gt;
| maintenance&lt;br /&gt;
| Used during upgrade and install. This must not have any blocks, and it is a good idea if it does not have links to other places - for example there should not be a home link in the footer.&lt;br /&gt;
|-&lt;br /&gt;
| print&lt;br /&gt;
| Used when the page is being displayed specifically for printing.&lt;br /&gt;
|-&lt;br /&gt;
| redirect&lt;br /&gt;
| Used when a redirection is occurring&lt;br /&gt;
|-&lt;br /&gt;
| report&lt;br /&gt;
| Used for reports.&lt;br /&gt;
|-&lt;br /&gt;
| secure&lt;br /&gt;
| Used for safebrowser and securewindow.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Theme changes in 2.0]]&lt;br /&gt;
* [[Adding courses and categories to the custom menu]] &lt;br /&gt;
* [[Making a horizontal dock]]&lt;br /&gt;
* [[Adding theme upgrade code]]&lt;br /&gt;
* [[Styling and customising the dock]] &lt;br /&gt;
* [[Changing topic or weekly outline to Page heading]]&lt;br /&gt;
* [[jQuery]]&lt;br /&gt;
&lt;br /&gt;
===Moodle 2.2+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.2 how to clone a Moodle 2.2 theme]]&lt;br /&gt;
&lt;br /&gt;
===Moodle Bootstrap Themes - Moodle 2.5+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.5 How to copy and customise the Simple (bootstrap) theme]]&lt;br /&gt;
&lt;br /&gt;
[[de:Designs 2.0]]&lt;br /&gt;
[[es:Temas 2.0]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Moodle.org_courses_and_course_formats_forum_help&amp;diff=43869</id>
		<title>Moodle.org courses and course formats forum help</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Moodle.org_courses_and_course_formats_forum_help&amp;diff=43869"/>
		<updated>2014-02-16T15:57:34Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Courses and course formats forum posting guide ==&lt;br /&gt;
&lt;br /&gt;
When posting on the forum, whether asking questions, wanting help or reporting an issue, it is really useful to include the following information in the post:&lt;br /&gt;
&lt;br /&gt;
1) Moodle version and release details.  They can be extracted from the &#039;version.php&#039; file in the &#039;root&#039; of your installation:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_43_07-F_moodledev_moodle26_version.php_-_Notepad%2B%2B_h.png]]&lt;br /&gt;
&lt;br /&gt;
2) Course format version and release details, if your question relates to a course format.  They can be extracted from the course formats &#039;version.php&#039; file:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_47_51-F_moodledev_moodle26_course_format_topcoll_version.php_-_Notepad%2B%2B_h.png]]&lt;br /&gt;
&lt;br /&gt;
And where you retrieved the version from, such as Moodle.org, GitHub etc.&lt;br /&gt;
&lt;br /&gt;
3) Often issues can arise with clashes with themes.  So, if you are using a contributed theme such as &#039;Essential&#039;, then provide those details too:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_52_02-F_moodledev_moodle26_theme_essential_version.php_-_Notepad%2B%2B_h.png]]&lt;br /&gt;
&lt;br /&gt;
Along with where you retrieved the version from.  If you are using a core theme, then just state which one as their version is linked to the Moodle version.&lt;br /&gt;
&lt;br /&gt;
If you do not have access to the file system, then as an &#039;administrator&#039; under &#039;Site administration&#039; -&amp;gt; &#039;Notifications&#039; you will find the Moodle release details:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_15_19_05-Moo26_Administration_Notifications_h.png]]&lt;br /&gt;
&lt;br /&gt;
And under &#039;Site administration&#039; -&amp;gt; &#039;Plugins&#039; -&amp;gt; &#039;Plugins overview&#039; with &#039;Showing add-ons only&#039;:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_15_34_04-2014-02-04_15_31_23-Moo26_Administration_Plugins_Plugins_overview_h.png]]&lt;br /&gt;
&lt;br /&gt;
You will see the &#039;version&#039; number for both course formats and themes.&lt;br /&gt;
&lt;br /&gt;
4) A picture speaks a thousand words, so an annotated screen shot explaining the issue goes a long way:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_55_22-Course_t_h.png]]&lt;br /&gt;
&lt;br /&gt;
5) All of the steps you did to produce the issue in the first place.  Include where possible the test data files you used.&lt;br /&gt;
&lt;br /&gt;
6) Details of any other contributed plugins you have installed.  Which you consider relevant to the post.&lt;br /&gt;
&lt;br /&gt;
All of this information makes it much easier for the person who replies to:&lt;br /&gt;
&lt;br /&gt;
Replicate the issue using the same set-up as you have.&lt;br /&gt;
Understand exactly what you are talking about.&lt;br /&gt;
Reply quicker and not to ask for the details this guide states as they cannot replicate.&lt;br /&gt;
&lt;br /&gt;
This will benefit you in getting the response you need.  So please supply the information.&lt;br /&gt;
&lt;br /&gt;
--[[User:Gareth Barnard|Gareth Barnard]] ([[User talk:Gareth Barnard|talk]]) 23:57, 16 February 2014 (WST)&lt;br /&gt;
&lt;br /&gt;
P.S. In case you are wondering what the answer is to the question posed in the screen shot:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_58_45-Edit_course_settings_h.png]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Moodle.org_courses_and_course_formats_forum_help&amp;diff=43868</id>
		<title>Moodle.org courses and course formats forum help</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Moodle.org_courses_and_course_formats_forum_help&amp;diff=43868"/>
		<updated>2014-02-16T15:52:09Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Created page with &amp;quot; == Courses and course formats forum posting guide ==  When posting on the forum, whether asking questions, wanting help or reporting an issue, it is really useful to include ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Courses and course formats forum posting guide ==&lt;br /&gt;
&lt;br /&gt;
When posting on the forum, whether asking questions, wanting help or reporting an issue, it is really useful to include the following information in the post:&lt;br /&gt;
&lt;br /&gt;
1) Moodle version and release details.  They can be extracted from the &#039;version.php&#039; file in the &#039;root&#039; of your installation:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_43_07-F_moodledev_moodle26_version.php_-_Notepad%2B%2B_h.png]]&lt;br /&gt;
&lt;br /&gt;
2) Course format version and release details, if your question relates to a course format.  They can be extracted from the course formats &#039;version.php&#039; file:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_47_51-F_moodledev_moodle26_course_format_topcoll_version.php_-_Notepad%2B%2B_h.png]]&lt;br /&gt;
&lt;br /&gt;
And where you retrieved the version from, such as Moodle.org, GitHub etc.&lt;br /&gt;
&lt;br /&gt;
3) Often issues can arise with clashes with themes.  So, if you are using a contributed theme such as &#039;Essential&#039;, then provide those details too:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_52_02-F_moodledev_moodle26_theme_essential_version.php_-_Notepad%2B%2B_h.png]]&lt;br /&gt;
&lt;br /&gt;
Along with where you retrieved the version from.  If you are using a core theme, then just state which one as their version is linked to the Moodle version.&lt;br /&gt;
&lt;br /&gt;
If you do not have access to the file system, then as an &#039;administrator&#039; under &#039;Site administration&#039; -&amp;gt; &#039;Notifications&#039; you will find the Moodle release details:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_15_19_05-Moo26_Administration_Notifications_h.png]]&lt;br /&gt;
&lt;br /&gt;
And under &#039;Site administration&#039; -&amp;gt; &#039;Plugins&#039; -&amp;gt; &#039;Plugins overview&#039; with &#039;Showing add-ons only&#039;:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_15_34_04-2014-02-04_15_31_23-Moo26_Administration_Plugins_Plugins_overview_h.png]]&lt;br /&gt;
&lt;br /&gt;
You will see the &#039;version&#039; number for both course formats and themes.&lt;br /&gt;
&lt;br /&gt;
4) A picture speaks a thousand words, so an annotated screen shot explaining the issue goes a long way:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_55_22-Course_t_h.png]]&lt;br /&gt;
&lt;br /&gt;
5) All of the steps you did to produce the issue in the first place.  Include where possible the test data files you used.&lt;br /&gt;
&lt;br /&gt;
6) Details of any other contributed plugins you have installed.  Which you consider relevant to the post.&lt;br /&gt;
&lt;br /&gt;
All of this information makes it much easier for the person who replies to:&lt;br /&gt;
&lt;br /&gt;
Replicate the issue using the same set-up as you have.&lt;br /&gt;
Understand exactly what you are talking about.&lt;br /&gt;
Reply quicker and not to ask for the details this guide states as they cannot replicate.&lt;br /&gt;
&lt;br /&gt;
This will benefit you in getting the response you need.  So please supply the information.&lt;br /&gt;
&lt;br /&gt;
In case you are wondering what the answer is to the question posed in the screen shot:&lt;br /&gt;
&lt;br /&gt;
[[File:2014-02-04_14_58_45-Edit_course_settings_h.png]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_58_45-Edit_course_settings_h.png&amp;diff=43867</id>
		<title>File:2014-02-04 14 58 45-Edit course settings h.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_58_45-Edit_course_settings_h.png&amp;diff=43867"/>
		<updated>2014-02-16T15:50:26Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Courses and course formats forum posting guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Courses and course formats forum posting guide&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_55_22-Course_t_h.png&amp;diff=43866</id>
		<title>File:2014-02-04 14 55 22-Course t h.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_55_22-Course_t_h.png&amp;diff=43866"/>
		<updated>2014-02-16T15:49:00Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Courses and course formats forum posting guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Courses and course formats forum posting guide&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:2014-02-04_15_34_04-2014-02-04_15_31_23-Moo26_Administration_Plugins_Plugins_overview_h.png&amp;diff=43865</id>
		<title>File:2014-02-04 15 34 04-2014-02-04 15 31 23-Moo26 Administration Plugins Plugins overview h.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:2014-02-04_15_34_04-2014-02-04_15_31_23-Moo26_Administration_Plugins_Plugins_overview_h.png&amp;diff=43865"/>
		<updated>2014-02-16T15:47:45Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Courses and course formats forum posting guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Courses and course formats forum posting guide&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:2014-02-04_15_19_05-Moo26_Administration_Notifications_h.png&amp;diff=43864</id>
		<title>File:2014-02-04 15 19 05-Moo26 Administration Notifications h.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:2014-02-04_15_19_05-Moo26_Administration_Notifications_h.png&amp;diff=43864"/>
		<updated>2014-02-16T15:46:23Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Courses and course formats forum posting guideCourses and course formats forum posting guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Courses and course formats forum posting guideCourses and course formats forum posting guide&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_52_02-F_moodledev_moodle26_theme_essential_version.php_-_Notepad%2B%2B_h.png&amp;diff=43863</id>
		<title>File:2014-02-04 14 52 02-F moodledev moodle26 theme essential version.php - Notepad++ h.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_52_02-F_moodledev_moodle26_theme_essential_version.php_-_Notepad%2B%2B_h.png&amp;diff=43863"/>
		<updated>2014-02-16T15:44:27Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Courses and course formats forum posting guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Courses and course formats forum posting guide&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_47_51-F_moodledev_moodle26_course_format_topcoll_version.php_-_Notepad%2B%2B_h.png&amp;diff=43862</id>
		<title>File:2014-02-04 14 47 51-F moodledev moodle26 course format topcoll version.php - Notepad++ h.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_47_51-F_moodledev_moodle26_course_format_topcoll_version.php_-_Notepad%2B%2B_h.png&amp;diff=43862"/>
		<updated>2014-02-16T15:42:36Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Courses and course formats forum posting guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Courses and course formats forum posting guide&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_43_07-F_moodledev_moodle26_version.php_-_Notepad%2B%2B_h.png&amp;diff=43861</id>
		<title>File:2014-02-04 14 43 07-F moodledev moodle26 version.php - Notepad++ h.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:2014-02-04_14_43_07-F_moodledev_moodle26_version.php_-_Notepad%2B%2B_h.png&amp;diff=43861"/>
		<updated>2014-02-16T15:40:46Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Courses and course formats forum posting guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Courses and course formats forum posting guide&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=NEWMODULE_Adding_capabilities&amp;diff=43739</id>
		<title>NEWMODULE Adding capabilities</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=NEWMODULE_Adding_capabilities&amp;diff=43739"/>
		<updated>2014-02-08T10:41:21Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Fixed typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{New_Module}}&lt;br /&gt;
In order to add a capabilities for your &amp;lt;&amp;lt;NEWMODULE&amp;gt;&amp;gt; you need to:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==1. Create a file access.php in the &amp;lt;&amp;lt;NEWMODULE&amp;gt;&amp;gt;/db directory==&lt;br /&gt;
&lt;br /&gt;
This should contain a list of the capabilities that you want to define. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$capabilities = array(&lt;br /&gt;
    &#039;mod/&amp;lt;&amp;lt;NEWMODULE&amp;gt;&amp;gt;:&amp;lt;&amp;lt;CAPABILITYNAME&amp;gt;&amp;gt;&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;riskbitmask&#039;  =&amp;gt; RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,&lt;br /&gt;
        &#039;captype&#039;      =&amp;gt; &#039;write&#039;,&lt;br /&gt;
        &#039;contextlevel&#039; =&amp;gt; CONTEXT_MODULE,&lt;br /&gt;
        &#039;archetypes&#039;   =&amp;gt; array(&lt;br /&gt;
            &#039;student&#039;        =&amp;gt; CAP_ALLOW,&lt;br /&gt;
            &#039;teacher&#039;        =&amp;gt; CAP_ALLOW,&lt;br /&gt;
            &#039;editingteacher&#039; =&amp;gt; CAP_ALLOW,&lt;br /&gt;
            &#039;manager&#039;          =&amp;gt; CAP_ALLOW&lt;br /&gt;
        )&lt;br /&gt;
    ),&lt;br /&gt;
&lt;br /&gt;
    // Add more capabilities here ...&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The various parts of the capability definition are:&lt;br /&gt;
&lt;br /&gt;
===Capability name (&#039;mod/&amp;lt;&amp;lt;NEWMODULE&amp;gt;&amp;gt;:&amp;lt;&amp;lt;CAPABILITYNAME&amp;gt;&amp;gt;)===&lt;br /&gt;
&lt;br /&gt;
This is the internal name used for this this capability. In addition to this internal name, you should also add the language string &amp;lt;&amp;lt;NEWMODULE&amp;gt;&amp;gt;:&amp;lt;&amp;lt;CAPABILITYNAME&amp;gt;&amp;gt; to your module&#039;s language file, to give the capability a name that users will see in the interface.&lt;br /&gt;
&lt;br /&gt;
===riskbitmask===&lt;br /&gt;
&lt;br /&gt;
Allowing people to do various things sometimes requires introducing possible security risks. For example, if you can post to a forum, you can post unsolicited advertising. To a certain extent users have to be trusted. To help administrators and teachers know what the issues are, each capability should list any associated risks. See [[Hardening_new_Roles_system]]. will be reflected in the list of icons of each row of the &#039;Override permissions&#039;-&amp;gt;roles page.&lt;br /&gt;
&lt;br /&gt;
Technically, this value is a bit field, so you should combine the relevant risks constants with the &#039;|&#039; operator. So typical values might be:&lt;br /&gt;
* RISK_SPAM&lt;br /&gt;
* RISK_PERSONAL | RISK_XSS | RISK_DATALOSS&lt;br /&gt;
&lt;br /&gt;
===captype===&lt;br /&gt;
&lt;br /&gt;
Should be either &#039;read&#039; or &#039;write&#039;. &#039;read&#039; is for capabilities that just let you view things. &#039;write&#039; for capabilities that let you change things.&lt;br /&gt;
&lt;br /&gt;
===contextlevel===&lt;br /&gt;
&lt;br /&gt;
The context level where this capability is most relevant. If you are writing a module this will almost always be [[Context|CONTEXT_MODULE]]. (This does not have much effect. It is just used to sort and group capabilities on the define roles and override roles pages.)&lt;br /&gt;
&lt;br /&gt;
===archetypes===&lt;br /&gt;
&lt;br /&gt;
This section defines, for each role type, what default permissions those roles should be given when your module is first installed (or when a new capability is detected on upgrade).&lt;br /&gt;
&lt;br /&gt;
Normally, you just add one line for each role that you want to give the capability to. The line should look like &#039;roletype&#039; =&amp;gt; CAP_ALLOW. Just leave out roles that you do not want to get the capability be default. Very exceptionally, you may need to specify a default permission of CAP_PREVENT, CAP_PROHIBIT.&lt;br /&gt;
&lt;br /&gt;
Note that once a capability is established, permissions will not be automatically overwritten when a module is updated. If permissions have changed, an administrator must manually change or force capabilities to be [[:en:Manage_roles#Reset_role_to_defaults|reset to default]] for a role.&lt;br /&gt;
&lt;br /&gt;
==2. Get Moodle to load the updated capabilities==&lt;br /&gt;
&lt;br /&gt;
The capabilities you defined are only read (and copied into the Moodle database) when your module is installed or upgraded. So every time you edit the db/access.php file you must&lt;br /&gt;
# Increase your module&#039;s version number by editing the file mod/&amp;lt;&amp;lt;NEWMODULE&amp;gt;&amp;gt;/version.php.&lt;br /&gt;
# Go to the the Administration ► Notifications page, and click through the steps to let Moodle upgrade itself. You should see the name of your module in one of the steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==3. Checking the capability in your code==&lt;br /&gt;
&lt;br /&gt;
In order to check whether the current user has a particular capability, you need to use the has_capability function. To do that, first you have to get the appropriate context. In this case, it will be a module context.&lt;br /&gt;
&lt;br /&gt;
1. First we need to get the $cm id, and verify that it is correct (there are lots of different ways you might do this, this is only an example.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$cmid = required_param(&#039;cmid&#039;, PARAM_INT);&lt;br /&gt;
if (!$cm = get_coursemodule_from_id(&#039;&amp;lt;&amp;lt;NEWMODULE&amp;gt;&amp;gt;&#039;, $cmid)) {&lt;br /&gt;
    error(&amp;quot;Course module ID was incorrect&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Then you get the module context:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$context = get_context_instance(CONTEXT_MODULE, $cm-&amp;gt;id);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Finally, you can actually check the permission&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if (has_capability(&#039;mod/&amp;lt;&amp;lt;NEWMODULE&amp;gt;&amp;gt;:&amp;lt;&amp;lt;CAPABILITYNAME&amp;gt;&amp;gt;&#039;, $context)) {&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Normally, you do 1. and 2. once at the top of a script, and then call has_capability as needed within the script with the appropriate capabilities.&lt;br /&gt;
&lt;br /&gt;
===Useful variations===&lt;br /&gt;
&lt;br /&gt;
====Controlling overall access to a script====&lt;br /&gt;
&lt;br /&gt;
Suppose you have a page that should only be available to users with a particular capability. For example, only users with mod/quiz:viewreports should be able to access mod/quiz/report.php. In cases like this, you can use the require_capability function:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_capability($capability, $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
near the top of your script. (As soon as you have got the context and called require_login is a good time.) All this does internally is&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if (!has_capability($capability, $context)) {&lt;br /&gt;
    // Display error and exit.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
but using require_capability makes your code simpler and is recommended. (Of course, anywhere you might print a link to a page like this, you should only print the link if the user has the right capability.)&lt;br /&gt;
&lt;br /&gt;
====Getting a list of users with a capability====&lt;br /&gt;
&lt;br /&gt;
Suppose you need to get a list of all the users with a particular capability. (For example, the quiz reports list all the users with the mod/quiz:attempt capability. Then you can use the get_users_by_capability function. &lt;br /&gt;
&lt;br /&gt;
====Checking the permissions of another user====&lt;br /&gt;
&lt;br /&gt;
There is an optional 3rd parameter to has_capability that you can use to check another user&#039;s permissions:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
has_capability($capability, $context, $otheruser-&amp;gt;id);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Excluding administrators====&lt;br /&gt;
&lt;br /&gt;
Administrators have a magic &#039;moodle/site:doanything&#039; capability that gives them every other capability. If you wish to disable that magic override for one particular capability check, you can use the optional 4th parameter to has capability:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
has_capability($capability, $context, NULL, false);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
However, you normally should not do this.&lt;br /&gt;
&lt;br /&gt;
====Performance considerations====&lt;br /&gt;
&lt;br /&gt;
The has_capability function has been carefully optimised, and is pretty fast and you should not really worry. However, it has to perform a fairly complex computation, and if you are going to make exactly the same has_capability call several times in a page (perhaps in a loop) it is probably worth moving the permission check outside the loop. For example don&#039;t do:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
foreach ($attempts as $attempt) {&lt;br /&gt;
    if (has_capability(&#039;mod/quiz:viewreports&#039;, $context)) {&lt;br /&gt;
        // ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Instead do&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$canviewreports = has_capability(&#039;mod/quiz:viewreports&#039;, $context);&lt;br /&gt;
foreach ($attempts as $attempt) {&lt;br /&gt;
    if ($canviewreports) {&lt;br /&gt;
        // ...&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
get_users_by_capability is a very expensive computation. If you are calling it more than once in your script, you are probably doing something wrong ;-)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Access API]]&lt;br /&gt;
* [[Roles]]&lt;br /&gt;
* [[Hardening_new_Roles_system]] - information about risks&lt;br /&gt;
* [[NEWMODULE_Documentation]] - NEWMODULE Documentation front page&lt;br /&gt;
&lt;br /&gt;
[[Category:Roles]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=43735</id>
		<title>Themes overview</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=43735"/>
		<updated>2014-02-06T18:03:07Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Fixed paths as wrong against https://docs.moodle.org/dev/Using_images_in_a_theme#Overriding_plugin_images&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}Welcome to the new world of themes in Moodle 2.x!&lt;br /&gt;
&lt;br /&gt;
A Moodle theme allows the user to change the look and feel of a Moodle site.  Themes can be applied on the site, category, course and activity levels by users with permissions to do so.  Themes can be designed for specific devices such as mobile phones or tablets. This page explains how themes work in Moodle and is intended to help you create or modify most themes for Moodle 2.0&lt;br /&gt;
&lt;br /&gt;
You can use contributed themes or create your entire own to share with the community. Themes can also be based on parent themes with only few customizations. Themes accomplish this using CSS, changing the underlying markup structure and also adding Javascript to add more advanced behaviors.&lt;br /&gt;
&lt;br /&gt;
Most theme developers simply add a few changes to their new theme by basing it on an existing one. The Moodle Theme architecture is designed in such a way whereby the base theme will act as a fall-back that is used when nothing has been defined in the theme based on it. This makes it easy to create new themes that simply seek out to make minor changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.6==&lt;br /&gt;
{{Moodle 2.6}}&lt;br /&gt;
&lt;br /&gt;
===Fonts===&lt;br /&gt;
&lt;br /&gt;
CSS3 fonts can be now used in plugins, core and moodle themes. It is very similar to images in pix subdirectories (MDL-23493).&lt;br /&gt;
&lt;br /&gt;
===Chat Activity===&lt;br /&gt;
The Chat room window is now also styled via bootstrapbase. Themes based on bootstrapbase can now directly style or use &#039;customcss&#039; to style the chat window now. (MDL-42711)&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.5==&lt;br /&gt;
{{Moodle 2.5}}&lt;br /&gt;
&lt;br /&gt;
There is a new Bootstrap base theme. See [[Clean theme]] for more information.&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.4==&lt;br /&gt;
{{Moodle 2.4}}&lt;br /&gt;
&lt;br /&gt;
===HTML 5 doctype===&lt;br /&gt;
&lt;br /&gt;
By default Moodle is sending HTML5 doctype. Themes designers may decide to force old xhtml strict mode, but it is strongly discouraged and the site will not pass strictness validation. (MDL-34299)&lt;br /&gt;
&lt;br /&gt;
===Internet Explorer standards mode===&lt;br /&gt;
&lt;br /&gt;
Since 2.4 Moodle automatically sends X-UA-Compatible edge header, this should prevent Internet Explorer from switching to quirks or compatibility modes (MDL-36524). There is also a new workaround for intranet servers which previously identified recent IE browsers as IE7. (MDL-36481)&lt;br /&gt;
&lt;br /&gt;
===SVG icons===&lt;br /&gt;
&lt;br /&gt;
Most modern browsers support SVG icons. The benefit is that SVG scales perfectly to any screen resolution or zoom. It is now possible to add icons in SVG format to pix directories, Moodle uses SVG in supported browsers and PNG in legacy browsers. (MDL-22955)&lt;br /&gt;
&lt;br /&gt;
Please note that IE9 does not handle scaling of standard SVG icons properly, you may have to manually execute a special script from theme/base/cli/svgtool.php to alter the icons to be compatible with buggy IE9. (MDL-36436)&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.0==&lt;br /&gt;
&lt;br /&gt;
The theme system was completely redesigned in Moodle 2.0.  Known issues have been addressed and new features have been added to meet community requests.&lt;br /&gt;
&lt;br /&gt;
Unfortunately it was not possible to maintain backward compatibility, so all Moodle 1.x themes need to be recreated for Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
Major changes include:&lt;br /&gt;
* Clearer and more consistent CSS classes and IDs throughout all pages in Moodle&lt;br /&gt;
* Introduction of layout files (templates) describing overall layout HTML for many different types of pages in Moodle.&lt;br /&gt;
* Introduction of renderers, which produce the smaller &amp;quot;parts&amp;quot; of a HTML page.  Advanced themes can choose to override these too if they choose.&lt;br /&gt;
* Introduction of standard methods for adding Javascript to themes.&lt;br /&gt;
* Easier control over icons and images in Moodle.&lt;br /&gt;
* The old &amp;quot;standard&amp;quot; theme has been split into two themes:&lt;br /&gt;
**&#039;&#039;&#039;base&#039;&#039;&#039; - contains absolutely basic layout, and&lt;br /&gt;
**&#039;&#039;&#039;standard&#039;&#039;&#039; - which adds CSS to the base theme to make it look like the old standard theme.&lt;br /&gt;
* Performance tuning: In normal production mode CSS files are combined into a single optimised file, and both CSS and JavaScript files are minimised to ensure there are no wasted connections or traffic.  Files are heavily cached, but also versioned, so that users never need to clear their caches.&lt;br /&gt;
&lt;br /&gt;
==The structure of a theme==&lt;br /&gt;
&lt;br /&gt;
Some important things to know when building good themes:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;config.php&#039;&#039;&#039; - this file is required in every theme.  It defines configuration settings and definitions required to make the theme work in Moodle. These include theme, file, region, default region and options. &lt;br /&gt;
# &#039;&#039;&#039;Layouts and layout files&#039;&#039;&#039; -  in config.php there is one definition for each page type (see [[#theme_layouts_table|Appendix A: Theme layouts]] for a list of over 12 types).  Each page type definition tells Moodle which layout file will be used, what block regions this page type should display and so on.  The layout file contains the HTML and the minimum PHP required to display basic structure of pages. (If you know Moodle 1.9, it&#039;s like a combination of header.html and footer.html).&lt;br /&gt;
# &#039;&#039;&#039;The base theme&#039;&#039;&#039; - is not intended to be used for production sites.  It sets up the simplest possible generic layout and includes only CSS essential to that layout &#039;&#039;or&#039;&#039; to Moodle as a whole.  It tries not to make any unnecessary rules and makes as few assumptions as possible.  It&#039;s the perfect base on which to start designing a theme, as there are very few colours, borders, margins, and alignments to override.  You can just start adding what you need.&lt;br /&gt;
&lt;br /&gt;
===Files and folders===&lt;br /&gt;
A theme&#039;s files are placed in a folder with under moodle/theme folder and have subfolders. They are laid out like this:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Directory&lt;br /&gt;
! File&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| config.php&lt;br /&gt;
| Contains all of the configuration and definitions for each theme&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| lib.php &lt;br /&gt;
| Contains speciality classes and functions that are used by theme&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| renderers.php &lt;br /&gt;
| Contains any custom renderers for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| settings.php &lt;br /&gt;
| Contains custom theme settings. These local settings are defined by the theme allowing the theme user to easily alter something about the way it looks or operates. (eg a background colour, or a header image)&lt;br /&gt;
|-&lt;br /&gt;
| /&lt;br /&gt;
| version.php &lt;br /&gt;
| Contains the theme name, version number and Moodle version requirements for using the theme&lt;br /&gt;
|-&lt;br /&gt;
| /fonts/&lt;br /&gt;
| *.woff&lt;br /&gt;
| Theme fonts (since 2.6).&lt;br /&gt;
|-&lt;br /&gt;
| /fonts_core/ &lt;br /&gt;
| *.woff&lt;br /&gt;
| Contains fonts that override standard core fonts (since 2.6).&lt;br /&gt;
|-&lt;br /&gt;
| /fonts_plugins/plugintype/pluginname/ &lt;br /&gt;
| *.woff&lt;br /&gt;
| Contains fonts that override plugin fonts (since 2.6).&lt;br /&gt;
|-&lt;br /&gt;
| /javascript/ &lt;br /&gt;
| *.js&lt;br /&gt;
| All specialty JavaScript files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /lang/ &lt;br /&gt;
| &lt;br /&gt;
| Any special language files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /layout/ &lt;br /&gt;
| *.php&lt;br /&gt;
| Contains the layout files for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/ &lt;br /&gt;
| *.png, *.jpg, *.gif, *.svg&lt;br /&gt;
| Contains any images the theme makes use of either in CSS or in the layout files.&lt;br /&gt;
|-&lt;br /&gt;
|  /pix/&lt;br /&gt;
| favicon.ico &lt;br /&gt;
| The favicon to display for this theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/&lt;br /&gt;
| screenshot.png &lt;br /&gt;
| A screenshot of the theme to be displayed in on the theme selection screen.&lt;br /&gt;
|-&lt;br /&gt;
| /pix_core/ &lt;br /&gt;
| *.png, *.jpg, *.gif, *.svg&lt;br /&gt;
| Contains images that override standard core images.&lt;br /&gt;
|-&lt;br /&gt;
| /pix_plugins/plugintype/pluginname/ &lt;br /&gt;
| *.png, *.jpg, *.gif, *.svg&lt;br /&gt;
| Contains images that override plugin images.&lt;br /&gt;
|-&lt;br /&gt;
| /style/&lt;br /&gt;
| *.css&lt;br /&gt;
| Default location for CSS files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are also several other places that stylesheets can be included from (see the CSS how and why section below).&lt;br /&gt;
&lt;br /&gt;
It is possible to override icons used in base themes without interfering with core code by placing these in dataroot/pix and dataroot/pix_plugins. Where a theme extends a base theme and provides its own icons, these icons will still be used.&lt;br /&gt;
&lt;br /&gt;
==Theme options==&lt;br /&gt;
All theme options are set within the config.php file for the theme.  The settings that are most used are: parents, sheets, layouts, and javascripts. Have a look at the &#039;&#039;&#039;[[#theme_options_table|theme options table]]&#039;&#039;&#039; for a complete list of theme options which include lesser used specialised or advanced settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Basic theme config example===&lt;br /&gt;
Lets have a look at a basic theme configuration file and the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;newtheme&#039;;&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;parents = array(&lt;br /&gt;
    &#039;base&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;admin&#039;,&lt;br /&gt;
    &#039;blocks&#039;,&lt;br /&gt;
    &#039;calendar&#039;,&lt;br /&gt;
    &#039;course&#039;,&lt;br /&gt;
    &#039;grade&#039;,&lt;br /&gt;
    &#039;message&#039;,&lt;br /&gt;
    &#039;question&#039;,&lt;br /&gt;
    &#039;user&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    )&lt;br /&gt;
    //.......&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;javascripts_footer = array(&lt;br /&gt;
    &#039;navigation&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic theme example settings explained===&lt;br /&gt;
First up you will notice everything is added to $THEME. This is the theme&#039;s configuration object, it is created by Moodle using default settings and is then updated by whatever settings you add to it.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;name : The first setting, is the theme&#039;s name. This should simply be whatever your theme&#039;s name is, most likely whatever you named your theme directory.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;parents : This defines the themes that the theme will extend. In this case it is extending only the base theme.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;sheets : An array containing the names of the CSS stylesheets to include for this theme. Note that it is just the name of the stylesheet and does not contain the directory or the file extension. Moodle assumes that the theme&#039;s stylesheets will be located in the styles directory of the theme and have .css as an extension.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;layouts : In this example, two layouts have been defined to override the layouts from the base theme. For more information see the [[#Layouts|layouts]] section below.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;javascripts_footer : The final setting is to include a JavaScript file. Much like stylesheets, you only need to provide the files name. Moodle will assume it is in your themes JavaScript directory and be a .js file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: When you first begin writing themes, make sure you take a look at the configuration files of the other themes that get shipped with Moodle. You will get a good picture of how everything works, and what is going on in a theme, simply by reading it and taking notice of what it is including or excluding.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
===Locations of CSS files===&lt;br /&gt;
First lets look at where CSS can be included from within Moodle:&lt;br /&gt;
; \theme\themename\style\*.css : This is the default location for all of the stylesheets that are used by a theme and the place which should be used by a theme designer.&lt;br /&gt;
&lt;br /&gt;
New theme developers should note that the order in which CSS files are found and included creates a hierarchy.  This order ensures that the rules, within a theme&#039;s style sheets, take precedence over identical rules in other files that may have been introduced before.  This can both extend another files definitions (see parent array in the config file) and also ensures that the current theme&#039;s CSS rules/definitions have the last say.&lt;br /&gt;
&lt;br /&gt;
There are other locations that can be used (although very rarely) to include CSS in a page. A developer of a php file can manually specify a stylesheet from anywhere within Moodle, like the database. Usually, if code is doing this, it is because there is a non-theme config or plugin setting that contains information requires special CSS information.  As a theme designer you should be aware of, but not have to worry about, these locations of CSS files.  Here are some examples:&lt;br /&gt;
&lt;br /&gt;
; {pluginpath}\styles.css e.g. \block\blockname\styles.css or \mod\modname\styles.css : Every plugin can have its own styles.css file. This file should only contain the required CSS rules for the module and should not add anything to the look of the plugin such as colours, font sizes, or margins other than those that are truly required.&amp;lt;br /&amp;gt;Theme specific styles for a plugin should be located within the themes styles directory.&lt;br /&gt;
; {pluginpath}\styles_themename.css : This should only ever be used by plugin developers. It allows them to write CSS that is designed for a specific theme without having to make changes to that theme. You will notice that this is never used within Moodle and is designed to be used only by contributed code.&lt;br /&gt;
&lt;br /&gt;
As theme designers, we will only use the first method of introducing CSS: adding rules to a stylesheet file located in the theme&#039;s style directory.&lt;br /&gt;
&lt;br /&gt;
===Moodle&#039;s core CSS organisation===&lt;br /&gt;
The next thing to look at is the organisation of CSS and rules within a theme. Although as a theme designer it is entirely up to you as to how you create and organise your CSS. Please note that within the themes provided in the standard install by Moodle there is a very clear organisation of CSS.&lt;br /&gt;
&lt;br /&gt;
First is the  pagelayout.css file. This contains the CSS required to give the layouts their look and feel.  It doesn&#039;t contain any rules that affect the content generated by Moodle.&lt;br /&gt;
&lt;br /&gt;
Next is the core.css file. If you open up core you will notice that it contains all manner of general (usually simple) rules that don&#039;t relate to a specific section of Moodle but to Moodle as a whole.&lt;br /&gt;
&lt;br /&gt;
There can also be rules that relate to specific sections.  However, this is done only when there are only a handful of rules for that section. These small clusters of rules are grouped together and separated by comments identifying for which section each relates.&lt;br /&gt;
&lt;br /&gt;
Finally there are all the other CSS files, you will notice that there is a file for each section of Moodle that has a significant collection of rules.&lt;br /&gt;
&lt;br /&gt;
:For those who are familiar with Moodle 1.9 theme&#039;s, this organisation will be a big change. In 1.9, CSS was organised by its nature (for example: colours, layout, other).&lt;br /&gt;
&lt;br /&gt;
===How to write effective CSS rules within Moodle===&lt;br /&gt;
In Moodle 2.0, writing good CSS rules is incredibly important.&lt;br /&gt;
&lt;br /&gt;
Due to performance requirements and browser limitations, all of the CSS files are combined into a single CSS file that gets included every time. This means that rules need to be written in such a way as to minimise the chances of a collision leading to unwanted styles being applied. Whilst writing good CSS is something most designers strive for we have implemented several new body classes and prompt developers to use appropriate classnames.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;body&amp;gt; CSS id and classes ====&lt;br /&gt;
As of Moodle 2.0 the ID tag that gets applied to the body will always be a representation of the URI. For example if you are looking at a forum posting and the URI is &#039;/mod/forum/view.php&#039; then the body tags ID will be &#039;#page-mod-forum-view&#039;.&lt;br /&gt;
&lt;br /&gt;
As well as the body&#039;s ID attribute the URI is also exploded to form several CSS classes that get added to the body tag, so in the above example &#039;/mod/forum/view&#039; you would end up with the following classes being added to the body tag &#039;.path-mod&#039;, &#039;.path-mod-forum&#039;. Note that &#039;.path-mod-forum-view&#039; is not added as a class, this is intentionally left out to lessen confusion and duplication as rules can relate directly to the page by using the ID and do not require the final class.&lt;br /&gt;
&lt;br /&gt;
The body ID and body classes described above will form the bread and butter for many of the CSS rules you will need to write for your theme, however there are also several other very handy classes that get added to the body tag that will be beneficial to you once you start your journey down the rabbit hole that is themeing. Some of the more interesting classes are listed below.&lt;br /&gt;
&lt;br /&gt;
* If JavaScript is enabled then &#039;jsenabled&#039; will be added as a class to the body tag allowing you to style based on JavaScript being enabled or not.&lt;br /&gt;
* Either &#039;dir-rtl&#039; or &#039;dir-ltr&#039; will be added to the body as a class depending on the direction of the language pack: rtl = right to left, ltr = left to right. This allows you to determine your text-alignment based on language if required.&lt;br /&gt;
* A class will be added to represent the language pack currently in use, by default en_utf8 is used by Moodle and will result in the class &#039;lang-en_utf8&#039; being added to the body tag.&lt;br /&gt;
* The wwwroot for Moodle will also be converted to a class and added to the body tag allowing you to stylise your theme based on the URL through which it was reached. e.g. http://sam.moodle.local/moodle/ will become &#039;.sam-moodle-local—moodle&#039;&lt;br /&gt;
* If the current user is not logged then &#039;.notloggedin&#039; will be added to the body tag.&lt;br /&gt;
&lt;br /&gt;
What does all of this look like in practise? Well using the above example /mod/forum/view.php you would get at least the following body tag:&lt;br /&gt;
&amp;lt;code html4strict&amp;gt;&amp;lt;body id=”page-mod-forum-view” class=”path-mod path-mod-forum” /&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Writing your rules====&lt;br /&gt;
&lt;br /&gt;
By following the [[CSS coding style]] and CSS best-practices and understanding the [http://htmlhelp.com/reference/css/structure.html#cascade cascading order] of CSS a theme developer will reduce collisions and lines of CSS that is written. CSS classes have been placed where it is believed anyone may want to apply their own styles.&lt;br /&gt;
&lt;br /&gt;
When starting to write rules make sure that you have a good understanding of where you want those rules to be applied, it is a good idea to make the most of the body classes mentioned above.&lt;br /&gt;
If you want to write a rule for a specific page make use of the body tag&#039;s ID, e.g.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;#page-mod-forum-view .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to write a rule that will be applied all throughout the forum.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;.path-mod-forum .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The other very important thing to take into consideration is the structure leading up to the tag you want to style. Browsers apply conflicting styles with priority on the more specific selectors. It can be very beneficial to keep this in mind and write full selectors that rely on the structure of the tags leading to the tag you wish to style.&lt;br /&gt;
&lt;br /&gt;
By making use of body id&#039;s and classes and writing selectors to take into account the leading structure you can greatly minimise the chance of a collision both with Moodle now and in the future.&lt;br /&gt;
&lt;br /&gt;
==Layouts==&lt;br /&gt;
Layouts are defined in &#039;&#039;&#039;config.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
All themes are required to define the layouts they wish to be responsible for as well as create; however, many layout files are required by those layouts. If the theme is overriding another theme then it is a case of deciding which layouts this new theme should override. If the theme is a completely fresh start then you will need to define a layout for each of the different possibilities. &lt;br /&gt;
&lt;br /&gt;
It is also important to note that a new theme that will base itself on another theme (overriding it) does not need to define any layouts or use any layout files if there are no changes that it wishes to make to the layouts of the existing theme. The standard theme in Moodle is a good example of this as it extends the base theme simply adding CSS to achieve its look and feel.&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, layouts are defined in config.php within $THEME-&amp;gt;layouts. The following is an example of one such layout definition:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    // Standard layout with blocks, this is recommended for most pages with general information&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;base&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;&lt;br /&gt;
    )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The first thing Moodle looks at is the name of the layout, in this case it is `standard` (the array key in PHP), it then looks at the settings for the layout, this is the theme, file, regions, and default region. There are also a couple of other options that can be set by a layout.&lt;br /&gt;
&lt;br /&gt;
; theme : is the theme the layout file exists in. That&#039;s right: you can make use of layouts from other installed themes. &#039;&#039;Optional&#039;&#039;&lt;br /&gt;
; file : is the name of the layout file this layout wants to use. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; regions : is the different block regions (places you can put blocks) within the theme. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; defaultregion : is the default location when adding new blocks. &#039;&#039;&#039;Required if regions is non-empty, otherwise optional&#039;&#039;&#039;&lt;br /&gt;
; options : an array of layout specific options described in detail below. &#039;&#039;&#039;Optional&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;theme&#039;&#039;&#039; is optional. Normally the the layout file is looked for in the current theme, or, if it is not there, in the parent theme. However, you can use a layout file from any other theme by giving the theme name here.&lt;br /&gt;
&lt;br /&gt;
You can define whatever regions you like. You just need to pick a name for each one. Most themes just use one or both of &#039;&#039;&#039;side_pre&#039;&#039;&#039; and &#039;&#039;&#039;side_post&#039;&#039;&#039;, which is like &#039;left side&#039; and &#039;right side&#039;, except in right to left languages, when they are reversed. If you say in config.php that your the layout provides regions called &#039;fred&#039; and &#039;barney&#039;, then you must call $OUTPUT-&amp;gt;blocks_for_region(&#039;fred&#039;) and $OUTPUT-&amp;gt;blocks_for_region(&#039;barney&#039;) somewhere in the layout file.&lt;br /&gt;
&lt;br /&gt;
The final setting &#039;&#039;&#039;options&#039;&#039;&#039; is a special case that only needs to be set if you want to make use of it. This setting allows the theme designer to specify special options that they would like to create that can be later accessed within the layout file. This allows the theme to make design decisions during the definition and react upon those decisions in what ever layout file is being used.&lt;br /&gt;
&lt;br /&gt;
One such place this has been used is within the base theme. If you take a look first at theme/base/config.php you will notice that several layouts specify options &#039;&#039;&#039;nonavbar&#039;&#039;&#039; and &#039;&#039;&#039;nofooter&#039;&#039;&#039; which can both be set to either true or false. Then if we take a look at theme/base/layout/general.php you will spot lines like the following:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hasnavbar = (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar());&lt;br /&gt;
$hasfooter = (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;]));&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
............&lt;br /&gt;
&amp;lt;?php if ($hasnavbar) { ?&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
What you are seeing here is the use of those settings from the layout within the layout file. In this case it is being used to toggle the display of the navigation bar and page footer.&lt;br /&gt;
&lt;br /&gt;
==Layout files==&lt;br /&gt;
A layout file is a file that contains the core HTML structure for a layout including the header, footer, content and block regions. For those of you who are familiar with themes in Moodle 1.9 this is simply header.html and footer.html combined. Of course it is not all HTML, there are bits of HTML and content that Moodle needs to put into the page, within each layout file this will be done by a couple of simple PHP calls to get bits and pieces including content.&lt;br /&gt;
&lt;br /&gt;
Before learning more it is good to understand the two primary objects that will be used in your layout files: $OUTPUT and $PAGE.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$OUTPUT&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;core_renderer&amp;lt;/code&amp;gt; class which is defined in lib/outputrenderers.php. Each method is clearly documented there, along with which is appropriate for use within the layout files.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$PAGE&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;moodle_page&amp;lt;/code&amp;gt; class defined in lib/pagelib.php. Most of the things you will want to use are the properties that are all documented at the top of the file. If you are not familiar with PHP properties, you access them like $PAGE-&amp;gt;activityname, just like fields of an ordinary PHP object. (However, behind the scenes the value you get is produced by calling a function. Also, you cannot change these values, they are &#039;&#039;&#039;read-only&#039;&#039;&#039;. However, you don&#039;t need to understand all that if you are just using these properties in your theme.)&lt;br /&gt;
&lt;br /&gt;
The following is a very simple layout file to illustrate the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid) ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses) ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;table id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
            &amp;lt;?php&lt;br /&gt;
            echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
            ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We assume you know enough HTML to understand the basic structure above, but let&#039;s explain the PHP code since that is less obvious.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This occurs at the VERY top of the page, it must be the first bit of output and is responsible for adding the (X)HTML document type definition to the page. This of course is determined by the settings of the site and is one of the things that the theme designer has no control over.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we have started writing the opening html tag and have asked Moodle to give us the HTML attributes that should be applied to it. This again is determined by several settings within the actual HTML install.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This gets us the title for the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This very important call gets us the standard head HTML that needs to be within the HEAD tag of the page. This is where CSS and JavaScript requirements for the top of the page will be output as well as any special script or style tags.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid); ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses); ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Much like the html tag above we have started writing the body tag and have asked for Moodle to get us the desired ID and classes that should be applied to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading; ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are creating the header for the page. In this case we want the heading for the page, we want to display the login information which will be the current users username or a link to log in if they are not logged in, and we want the heading menu if there is one.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-pre&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is one of the most important calls within the file, it determines where the actual content for the page gets inserted.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-post&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This final bit of code gets the content for the footer of the page. It gets the login information which is the same as in the header, a home link, and the standard footer HTML which like the standard head HTML contains all of the script and style tags required by the page and requested to go in the footer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: Within Moodle 2.0 most of the JavaScript for the page will be included in the footer. This greatly helps reduce the loading time of the page.&lt;br /&gt;
&lt;br /&gt;
When writing layout files think about the different layouts and how the HTML that each makes use of will differ. You will most likely find you do not need a different layout file for each layout, most likely you will be able to reuse the layout files you create across several layouts. You can of course make use of layout options as well to further reduce the number of layout files you need to produce.&lt;br /&gt;
&lt;br /&gt;
Of course as mentioned above if you are customising an existing theme then you may not need to create any layouts or layout files at all.&lt;br /&gt;
&lt;br /&gt;
==Language File==&lt;br /&gt;
&lt;br /&gt;
You need to create a language file for your theme with a few standard strings in it. At a minimum create a file called lang/en/theme_themename.php in your theme folder. For example, the &#039;standard&#039; theme has a language file called lang/en/theme_standard.php. &lt;br /&gt;
&lt;br /&gt;
You &#039;&#039;&#039;must&#039;&#039;&#039; define the following lines in your file (example is from standard theme, adapt as required):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Standard&#039;;&lt;br /&gt;
$string[&#039;region-side-post&#039;] = &#039;Right&#039;;&lt;br /&gt;
$string[&#039;region-side-pre&#039;] = &#039;Left&#039;;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;This theme is a very basic white theme, with a minimum amount of &lt;br /&gt;
 CSS added to the base theme to make it actually usable.&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without the above you will get notices for the missing strings.&lt;br /&gt;
&lt;br /&gt;
==Making use of images==&lt;br /&gt;
Right at the start when listing the features of the new themes system one of the features mentioned was the ability to override any of the standard images within Moodle from within your theme. At this point we will look at both how to make use of your own images within your theme, and secondly how to override the images being used by Moodle.&lt;br /&gt;
So first up a bit about images within Moodle,&lt;br /&gt;
&lt;br /&gt;
# Images you want to use within your theme &#039;&#039;&#039;need&#039;&#039;&#039; to be located within your theme&#039;s pix directory.&lt;br /&gt;
# You can use sub directories within the pix directory of your theme.&lt;br /&gt;
# Images used by Moodle&#039;s core are located within the pix directory of Moodle.&lt;br /&gt;
# Modules, blocks and other plugins should also store their images within a pix directory.&lt;br /&gt;
&lt;br /&gt;
So making use of your own images first up. Lets assume you have added two image files to the pix directory of your theme.&lt;br /&gt;
&lt;br /&gt;
* /theme/yourthemename/pix/imageone.jpg&lt;br /&gt;
* /theme/yourthemename/pix/subdir/imagetwo.png&lt;br /&gt;
&lt;br /&gt;
Notice that one image is a JPEG image, and the second is a PNG. Also the second image is in a subdirectory.&lt;br /&gt;
&lt;br /&gt;
The following code snippet illustrates how to make use of your images within HTML, such as if you wanted to use them within a layout file.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;imageone&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;subdir/imagetwo&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT&#039;&#039;&#039; include the image file extension. Moodle will work it out automatically and it will not work if you do include it.&lt;br /&gt;
&lt;br /&gt;
In this case rather than writing out the URL to the image we use a method of Moodle&#039;s output library. Its not too important how that functions works but it is important that we use it as it is what allows images within Moodle to be over-rideable.&lt;br /&gt;
&lt;br /&gt;
The following is how you would use the images from within CSS as background images.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.divone {&lt;br /&gt;
    background-image: url([[pix:theme|imageone]]);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.divtwo {&lt;br /&gt;
    background-image: url([[pix:theme|subdir/imagetwo]]);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If this case we have to use some special notations that Moodle looks for. Whenever Moodle hands out a CSS file it first searches for all &#039;&#039;[[something]]&#039;&#039; tags and replaces them with what is required.&lt;br /&gt;
&lt;br /&gt;
The final thing to notice with both of the cases above is that at no point do we include the images file extension. &lt;br /&gt;
The reason for this leads us into the next topic, how to override images.&lt;br /&gt;
&lt;br /&gt;
From within a theme you can VERY easily override any standard image within Moodle by simply adding the replacement image to the theme&#039;s pix directory in the same sub directory structure as it is in Moodle.&lt;br /&gt;
So for instance we wanted to override the following two images:&lt;br /&gt;
# /pix/moodlelogo.gif&lt;br /&gt;
# /pix/i/user.gif&lt;br /&gt;
We would simply need to add our replacement images to the theme in the following locations&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.gif&lt;br /&gt;
# /theme/themename/pix_core/i/user.gif&lt;br /&gt;
&#039;&#039;Note that we have created a &#039;&#039;&#039;pix_core&#039;&#039;&#039; directory in our theme. For module images we need a &#039;&#039;&#039;pix_mod&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Now the other very cool thing to mention is that Moodle looks for not just replacements of the same image type (jpg, gif, etc...) but also replacements in any image format. This is why above when working with our images we never specified the images file extension.&lt;br /&gt;
This means that the following would also work:&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.png&lt;br /&gt;
# /theme/themename/pix_core/i/user.bmp&lt;br /&gt;
&lt;br /&gt;
For a more detailed description of how this all works see the page on [[Using images in a theme]].&lt;br /&gt;
&lt;br /&gt;
==Adding custom fonts==&lt;br /&gt;
{{Moodle 2.6}}&lt;br /&gt;
&lt;br /&gt;
CSS3 standard introduced the possibility to specify custom fonts, see [http://www.w3schools.com/css3/css3_fonts.asp CSS3 Fonts tutorial].&lt;br /&gt;
&lt;br /&gt;
Since 2.6 Moodle includes support for plugin or theme fonts. It is very similar to theme images and pix subdirectories.&lt;br /&gt;
&lt;br /&gt;
===Font file locations===&lt;br /&gt;
&lt;br /&gt;
Depending on where you intend to use the font put it into one of the following locations:&lt;br /&gt;
* /lib/fonts/ - fonts used in core&lt;br /&gt;
* /plugindir/fonts/ - fonts used by plugin&lt;br /&gt;
* /theme/sometheme/fonts/ - theme specific fonts&lt;br /&gt;
&lt;br /&gt;
You can also override core and plugin fonts in theme:&lt;br /&gt;
* /theme/sometheme/fonts_core/ - overridden core fonts&lt;br /&gt;
* /theme/sometheme/fonts_plugins/plugintype_pluginname/ - overridden fonts of some plugin&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* subdirectories are not allowed&lt;br /&gt;
* use only lowercase alphanumeric characters and underscore in font file names&lt;br /&gt;
* WOFF (Web Open Font Format), TTF (True Type Fonts), OTF (OpenType Fonts) and EOT (Embedded OpenType) fonts are supported, but for the sake of humanity (And [https://tracker.moodle.org/browse/MDL-15169 MDL_15169] ) please use only WOFF fonts to encourage the quick death of IE8.&lt;br /&gt;
&lt;br /&gt;
===CSS placeholders===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
    font-family: ThreeDumb;&lt;br /&gt;
    src: url([[font:mod_book|3dumb.woff]]);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The placeholder references file /mod/book/fonts/3dumb.woff, the new fontface could be for example used for book headings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.path-mod-book .book_chapter_title {&lt;br /&gt;
    font-family: ThreeDumb;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you want to use some font in theme only, you can for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
    font-family: goodDogFont;&lt;br /&gt;
    src: url([[font:theme|good_dog.woff]]);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
a {font-family:goodDogFont;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The font would be stored in /theme/yourtheme/fonts/good_dog.woff file.&lt;br /&gt;
&lt;br /&gt;
===More free fonts===&lt;br /&gt;
&lt;br /&gt;
Please respect all licenses for font redistribution, you can get some nice free fonts from [http://www.fontsquirrel.com http://www.fontsquirrel.com] for example.&lt;br /&gt;
&lt;br /&gt;
===Warning===&lt;br /&gt;
&lt;br /&gt;
This is not intended for forcing of something like Comic Sans on all your visitors...&lt;br /&gt;
&lt;br /&gt;
==Unobvious Things==&lt;br /&gt;
===Getting Your Theme to Appear Correctly in Theme Selector===&lt;br /&gt;
If you follow the examples on this page to the letter, when you go to the Theme Selector page you may be discouraged to find that your theme does not appear like the other themes do. In fact, instead of your theme&#039;s name, you will see something along the lines of &amp;lt;nowiki&amp;gt;[[pluginname]]&amp;lt;/nowiki&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
To correct this, you must add the theme/THEMENAME/lang/en/theme_THEMENAME.php file, where THEMENAME is the name of the theme folder. Inside that file, add the string &amp;quot;$string[&#039;pluginname&#039;] = &#039;THEMENAME&#039;; &amp;quot;. Make THEMENAME the name of your theme, however you want it displayed in the Theme selector.&lt;br /&gt;
&lt;br /&gt;
Also, make sure to change your config.php file and version.php file to reflect the correct name:&lt;br /&gt;
&lt;br /&gt;
In config.php: $THEME-&amp;gt;name = &#039;NAME&#039;;&lt;br /&gt;
&lt;br /&gt;
In version.php: $plugin-&amp;gt;component = &#039;theme_NAME&#039;; // Full name of the plugin (used for diagnostics)&lt;br /&gt;
&lt;br /&gt;
The screenshot for the theme should be about 500x400 px.&lt;br /&gt;
&lt;br /&gt;
===Required theme divs===&lt;br /&gt;
&lt;br /&gt;
Some parts of Moodle may rely on particular divs, for example the div with id &#039;page-header&#039;.&lt;br /&gt;
&lt;br /&gt;
Consequently all themes must include at least the divs (with the same ids) that are present in the &#039;base&#039; theme. &lt;br /&gt;
&lt;br /&gt;
Missing out these elements may result in unexpected behaviour within specific modules or other plugins.&lt;br /&gt;
&lt;br /&gt;
==Appendix A==&lt;br /&gt;
===Theme options as of 17th April 2013===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_options_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting&lt;br /&gt;
! Effect&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;csspostprocess&#039;&#039;&#039;&lt;br /&gt;
|  Allows the user to provide the name of a function that all CSS should be passed to before being delivered.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;editor_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include within the body of the editor.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;enable_dock&#039;&#039;&#039;&lt;br /&gt;
|  If set to true the side dock is enabled for blocks&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;hidefromselector&#039;&#039;&#039;&lt;br /&gt;
| Used to hide a theme from the theme selector (unless theme designer mode is on). Accepts true or false.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;filter_mediaplugin_colors&#039;&#039;&#039;&lt;br /&gt;
|  Used to control the colours used in the small media player for the filters&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array containing the names of JavaScript files located in /javascript/ to include in the theme. (gets included in the head)&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts_footer&#039;&#039;&#039;&lt;br /&gt;
|  As above but will be included in the page footer.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;larrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the left arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;layouts&#039;&#039;&#039;&lt;br /&gt;
|  An array setting the layouts for the theme&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;name&#039;&#039;&#039;&lt;br /&gt;
| Name of the theme. Most likely the name of the directory in which this file resides.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents&#039;&#039;&#039;&lt;br /&gt;
|  An array of themes to inherit from&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array of JavaScript files NOT to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets not to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;plugins_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of plugin sheets to ignore and not include.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;rarrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the right arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;renderfactory&#039;&#039;&#039;&lt;br /&gt;
|  Sets a custom render factory to use with the theme, used when working with custom renderers.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;resource_mp3player_colors&#039;&#039;&#039;&lt;br /&gt;
|  Controls the colours for the MP3 player&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include for this theme. Should be located in the theme&#039;s style directory.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;supportscssoptimisation&#039;&#039;&#039;&lt;br /&gt;
|  When set to &#039;FALSE&#039; then the theme will not be affected by the &#039;CSS Optimiser&#039;.  The &#039;CSS Optimiser&#039; is enabled in Development &amp;gt; Experimental &amp;gt; Experimental settings.  When it is enabled CSS will be run through an optimisation process before being cached. The optimiser processes the CSS removing duplicate rules and styles, as well as white space removable and reformatting. Please note turning this on at the same time as theme designer mode is awful for performance but will help theme designers create optimised CSS.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===The different layouts as of 21st April 2013===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_layouts_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Layout&lt;br /&gt;
! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| base&lt;br /&gt;
| Most backwards compatible layout without the blocks - this is the layout used by default.&lt;br /&gt;
|- &lt;br /&gt;
| standard&lt;br /&gt;
| Standard layout with blocks, this is recommended for most pages with general information.&lt;br /&gt;
|- &lt;br /&gt;
| course&lt;br /&gt;
| Main course page.&lt;br /&gt;
|- &lt;br /&gt;
| coursecategory&lt;br /&gt;
| Use for browsing through course categories.&lt;br /&gt;
|- &lt;br /&gt;
| incourse&lt;br /&gt;
| Default layout while browsing a course, typical for modules.&lt;br /&gt;
|- &lt;br /&gt;
| frontpage&lt;br /&gt;
| The site home page.&lt;br /&gt;
|- &lt;br /&gt;
| admin&lt;br /&gt;
| Administration pages and scripts.&lt;br /&gt;
|- &lt;br /&gt;
| mydashboard&lt;br /&gt;
| My dashboard page.&lt;br /&gt;
|- &lt;br /&gt;
| mypublic&lt;br /&gt;
| My public page.&lt;br /&gt;
|- &lt;br /&gt;
| login&lt;br /&gt;
| The login page.&lt;br /&gt;
|-&lt;br /&gt;
| popup&lt;br /&gt;
| Pages that appear in pop-up windows - no navigation, no blocks, no header.&lt;br /&gt;
|-&lt;br /&gt;
| frametop&lt;br /&gt;
| Used for legacy frame layouts only. No blocks and minimal footer.&lt;br /&gt;
|-&lt;br /&gt;
| embedded&lt;br /&gt;
| Used for embedded pages, like iframe/object embedded in moodleform - it needs as much space as possible&lt;br /&gt;
|-&lt;br /&gt;
| maintenance&lt;br /&gt;
| Used during upgrade and install. This must not have any blocks, and it is a good idea if it does not have links to other places - for example there should not be a home link in the footer.&lt;br /&gt;
|-&lt;br /&gt;
| print&lt;br /&gt;
| Used when the page is being displayed specifically for printing.&lt;br /&gt;
|-&lt;br /&gt;
| redirect&lt;br /&gt;
| Used when a redirection is occurring&lt;br /&gt;
|-&lt;br /&gt;
| report&lt;br /&gt;
| Used for reports.&lt;br /&gt;
|-&lt;br /&gt;
| secure&lt;br /&gt;
| Used for safebrowser and securewindow.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Theme changes in 2.0]]&lt;br /&gt;
* [[Adding courses and categories to the custom menu]] &lt;br /&gt;
* [[Making a horizontal dock]]&lt;br /&gt;
* [[Adding theme upgrade code]]&lt;br /&gt;
* [[Styling and customising the dock]] &lt;br /&gt;
* [[Changing topic or weekly outline to Page heading]]&lt;br /&gt;
* [[jQuery]]&lt;br /&gt;
&lt;br /&gt;
===Moodle 2.2+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.2 how to clone a Moodle 2.2 theme]]&lt;br /&gt;
&lt;br /&gt;
===Moodle Bootstrap Themes - Moodle 2.5+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.5 How to copy and customise the Simple (bootstrap) theme]]&lt;br /&gt;
&lt;br /&gt;
[[de:Designs 2.0]]&lt;br /&gt;
[[es:Temas 2.0]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43695</id>
		<title>Theme checklist</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43695"/>
		<updated>2014-02-01T16:11:18Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}So, you think your theme is finished? Well, Moodle is a big complex beast, and there are lots of obscure corners, that you might not know about. This page lists lots of things that you might have missed when working on your theme. To be sure your theme is really complete, you need to check these out.&lt;br /&gt;
&lt;br /&gt;
== Accessible colours ==&lt;br /&gt;
&lt;br /&gt;
Are the colours you have chosen accessible?  Is there a reasonable contrast difference between them?&lt;br /&gt;
&lt;br /&gt;
== All the different forms of the front page ==&lt;br /&gt;
&lt;br /&gt;
Depending on how many courses there are in your Moodle site, and how many of them the current user is enrolled in, the [[:en:Front_page|front page]] looks different. Have you tested all the different ways it can look?&lt;br /&gt;
&lt;br /&gt;
== Big report tables ==&lt;br /&gt;
&lt;br /&gt;
The [[:en:Gradebook|grader report]], and other similar reports like the quiz reports, are very big tables that don&#039;t fit on one screen. How does your theme cope. Is it easy for the teacher to scroll sideways to see all the data?&lt;br /&gt;
&lt;br /&gt;
== Clean install ==&lt;br /&gt;
&lt;br /&gt;
Have you installed and un-installed the theme on a &#039;pure&#039; installation?  That is an installation with no other contributed plugins.  This allows you to check for unintentional dependencies.&lt;br /&gt;
&lt;br /&gt;
== Code checker ==&lt;br /&gt;
&lt;br /&gt;
[https://moodle.org/plugins/view.php?plugin=local_codechecker Code checker] checks your code against the Moodle [https://docs.moodle.org/dev/Coding coding standards].  It is a useful tool for spotting issues and making your code readable to all who are familiar with the core code.  Do not take all messages literally, use your common sense and make changes that are sensible.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
Have you specified the correct dependencies for both parent themes and Moodle in the &#039;[https://docs.moodle.org/dev/version.php version.php]&#039; file?&lt;br /&gt;
&lt;br /&gt;
== Fake blocks ==&lt;br /&gt;
&lt;br /&gt;
While you are looking at the quiz, pay attention to the [[:en:Using_Quiz|Quiz navigation block]]. This is not a normal block that teachers or admins can add or remove, it is a &#039;Fake block&#039; that looks like any other block but is part of the Moodle UI. Are you happy with where it appears, and how it looks?&lt;br /&gt;
&lt;br /&gt;
Other parts of Moodle that use fake blocks are the [[:en:Lesson_module|Lesson activity]] and [[:en:Calendar|the calendar UI]].&lt;br /&gt;
&lt;br /&gt;
Fake blocks are attached to the first region or the &#039;defaultregion&#039; in the &#039;regions&#039; array for the &#039;layout&#039; in the &#039;layouts&#039; array in the &#039;config.php&#039; file.  So if the order is (&#039;side-pre&#039;, &#039;side-post&#039;) and you want fake blocks to be in &#039;side-post&#039; change the &#039;defaultregion&#039; to &#039;side-post&#039; and the &#039;regions&#039; array to (&#039;side-post&#039;, &#039;side-pre&#039;).&lt;br /&gt;
&lt;br /&gt;
== Instructions ==&lt;br /&gt;
&lt;br /&gt;
Have you provided a &#039;readme&#039; file containing: Install instructions, un-install instructions, version history and contact details for when things go wrong.&lt;br /&gt;
&lt;br /&gt;
== License ==&lt;br /&gt;
&lt;br /&gt;
Is all code GPLv3 (or compatible) licensed?&lt;br /&gt;
&lt;br /&gt;
== Maturity ==&lt;br /&gt;
&lt;br /&gt;
Have you correctly stated the maturity of the theme in the &#039;[https://docs.moodle.org/dev/version.php version.php]&#039; file?  This gives users and idea of how stable the code is.&lt;br /&gt;
&lt;br /&gt;
== Quiz &#039;secure&#039; pop-up ==&lt;br /&gt;
&lt;br /&gt;
When a quiz set to [[:en:Quiz_settings#Extra_restrictions_on_attempts|Full screen pop-up with some JavaScript security]] then the page uses a special &#039;secure&#039; layout template that should have minimal headers or links.&lt;br /&gt;
&lt;br /&gt;
== Readable fonts ==&lt;br /&gt;
&lt;br /&gt;
Are the fonts you have chosen readable?  Will they be difficult to read on small devices?&lt;br /&gt;
&lt;br /&gt;
== Right-to-left languages ==&lt;br /&gt;
&lt;br /&gt;
In languages like Hebrew or Farsi, lots of things that you made left-aligned probably need to be right-aligned instead. Moodle adds .dir-rtl or .dir-ltr class to the body element, which you can use in CSS rules.&lt;br /&gt;
&lt;br /&gt;
== Responsive ==&lt;br /&gt;
&lt;br /&gt;
Have you tested your theme for responsiveness on small devices?  Try resizing the browser window and see how it reacts.&lt;br /&gt;
&lt;br /&gt;
== Theme developer mode ==&lt;br /&gt;
&lt;br /&gt;
When &#039;Theme developer mode&#039; is &#039;on&#039;, all of the CSS files are sent individually.  When it is &#039;off&#039;, they are all combined together.  This can lead to some issues.  Check that your theme works with &#039;Theme designer mode off&#039;.&lt;br /&gt;
&lt;br /&gt;
== ... please add more things here in alphabetical order ... ==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43694</id>
		<title>Theme checklist</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43694"/>
		<updated>2014-02-01T16:08:04Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}So, you think your theme is finished? Well, Moodle is a big complex beast, and there are lots of obscure corners, that you might not know about. This page lists lots of things that you might have missed when working on your theme. To be sure your theme is really complete, you need to check these out.&lt;br /&gt;
&lt;br /&gt;
== Accessible colours ==&lt;br /&gt;
&lt;br /&gt;
Are the colours you have chosen accessible?  Is there a reasonable contrast difference between them?&lt;br /&gt;
&lt;br /&gt;
== All the different forms of the front page ==&lt;br /&gt;
&lt;br /&gt;
Depending on how many courses there are in your Moodle site, and how many of them the current user is enrolled in, the [[:en:Front_page|front page]] looks different. Have you tested all the different ways it can look?&lt;br /&gt;
&lt;br /&gt;
== Big report tables ==&lt;br /&gt;
&lt;br /&gt;
The [[:en:Gradebook|grader report]], and other similar reports like the quiz reports, are very big tables that don&#039;t fit on one screen. How does your theme cope. Is it easy for the teacher to scroll sideways to see all the data?&lt;br /&gt;
&lt;br /&gt;
== Clean install ==&lt;br /&gt;
&lt;br /&gt;
Have you installed and un-installed the theme on a &#039;pure&#039; installation?  That is an installation with no other contributed plugins.  This allows you to check for unintentional dependencies.&lt;br /&gt;
&lt;br /&gt;
== Code checker ==&lt;br /&gt;
&lt;br /&gt;
[https://moodle.org/plugins/view.php?plugin=local_codechecker Code checker] checks your code against the Moodle [https://docs.moodle.org/dev/Coding coding standards].  It is a useful tool for spotting issues and making your code readable to all who are familiar with the core code.  Do not take all messages literally, use your common sense and make changes that are sensible.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
Have you specified the correct dependencies for both parent themes and Moodle in the &#039;version.php&#039; file?&lt;br /&gt;
&lt;br /&gt;
== Fake blocks ==&lt;br /&gt;
&lt;br /&gt;
While you are looking at the quiz, pay attention to the [[:en:Using_Quiz|Quiz navigation block]]. This is not a normal block that teachers or admins can add or remove, it is a &#039;Fake block&#039; that looks like any other block but is part of the Moodle UI. Are you happy with where it appears, and how it looks?&lt;br /&gt;
&lt;br /&gt;
Other parts of Moodle that use fake blocks are the [[:en:Lesson_module|Lesson activity]] and [[:en:Calendar|the calendar UI]].&lt;br /&gt;
&lt;br /&gt;
Fake blocks are attached to the first region or the &#039;defaultregion&#039; in the &#039;regions&#039; array for the &#039;layout&#039; in the &#039;layouts&#039; array in the &#039;config.php&#039; file.  So if the order is (&#039;side-pre&#039;, &#039;side-post&#039;) and you want fake blocks to be in &#039;side-post&#039; change the &#039;defaultregion&#039; to &#039;side-post&#039; and the &#039;regions&#039; array to (&#039;side-post&#039;, &#039;side-pre&#039;).&lt;br /&gt;
&lt;br /&gt;
== Instructions ==&lt;br /&gt;
&lt;br /&gt;
Have you provided a &#039;readme&#039; file containing: Install instructions, un-install instructions, version history and contact details for when things go wrong.&lt;br /&gt;
&lt;br /&gt;
== License ==&lt;br /&gt;
&lt;br /&gt;
Is all code GPLv3 (or compatible) licensed?&lt;br /&gt;
&lt;br /&gt;
== Quiz &#039;secure&#039; pop-up ==&lt;br /&gt;
&lt;br /&gt;
When a quiz set to [[:en:Quiz_settings#Extra_restrictions_on_attempts|Full screen pop-up with some JavaScript security]] then the page uses a special &#039;secure&#039; layout template that should have minimal headers or links.&lt;br /&gt;
&lt;br /&gt;
== Readable fonts ==&lt;br /&gt;
&lt;br /&gt;
Are the fonts you have chosen readable?  Will they be difficult to read on small devices?&lt;br /&gt;
&lt;br /&gt;
== Right-to-left languages ==&lt;br /&gt;
&lt;br /&gt;
In languages like Hebrew or Farsi, lots of things that you made left-aligned probably need to be right-aligned instead. Moodle adds .dir-rtl or .dir-ltr class to the body element, which you can use in CSS rules.&lt;br /&gt;
&lt;br /&gt;
== Responsive ==&lt;br /&gt;
&lt;br /&gt;
Have you tested your theme for responsiveness on small devices?  Try resizing the browser window and see how it reacts.&lt;br /&gt;
&lt;br /&gt;
== Theme developer mode ==&lt;br /&gt;
&lt;br /&gt;
When &#039;Theme developer mode&#039; is &#039;on&#039;, all of the CSS files are sent individually.  When it is &#039;off&#039;, they are all combined together.  This can lead to some issues.  Check that your theme works with &#039;Theme designer mode off&#039;.&lt;br /&gt;
&lt;br /&gt;
== ... please add more things here in alphabetical order ... ==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43693</id>
		<title>Theme checklist</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43693"/>
		<updated>2014-02-01T15:33:06Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}So, you think your theme is finished? Well, Moodle is a big complex beast, and there are lots of obscure corners, that you might not know about. This page lists lots of things that you might have missed when working on your theme. To be sure your theme is really complete, you need to check these out.&lt;br /&gt;
&lt;br /&gt;
== Accessible colours ==&lt;br /&gt;
&lt;br /&gt;
Are the colours you have chosen accessible?  Is there a reasonable contrast difference between them?&lt;br /&gt;
&lt;br /&gt;
== All the different forms of the front page ==&lt;br /&gt;
&lt;br /&gt;
Depending on how many courses there are in your Moodle site, and how many of them the current user is enrolled in, the [[:en:Front_page|front page]] looks different. Have you tested all the different ways it can look?&lt;br /&gt;
&lt;br /&gt;
== Big report tables ==&lt;br /&gt;
&lt;br /&gt;
The [[:en:Gradebook|grader report]], and other similar reports like the quiz reports, are very big tables that don&#039;t fit on one screen. How does your theme cope. Is it easy for the teacher to scroll sideways to see all the data?&lt;br /&gt;
&lt;br /&gt;
== Code checker ==&lt;br /&gt;
&lt;br /&gt;
[https://moodle.org/plugins/view.php?plugin=local_codechecker Code checker] checks your code against the Moodle [https://docs.moodle.org/dev/Coding coding standards].  It is a useful tool for spotting issues and making your code readable to all who are familiar with the core code.  Do not take all messages literally, use your common sense and make changes that are sensible.&lt;br /&gt;
&lt;br /&gt;
== Fake blocks ==&lt;br /&gt;
&lt;br /&gt;
While you are looking at the quiz, pay attention to the [[:en:Using_Quiz|Quiz navigation block]]. This is not a normal block that teachers or admins can add or remove, it is a &#039;Fake block&#039; that looks like any other block but is part of the Moodle UI. Are you happy with where it appears, and how it looks?&lt;br /&gt;
&lt;br /&gt;
Other parts of Moodle that use fake blocks are the [[:en:Lesson_module|Lesson activity]] and [[:en:Calendar|the calendar UI]].&lt;br /&gt;
&lt;br /&gt;
Fake blocks are attached to the first region or the &#039;defaultregion&#039; in the &#039;regions&#039; array for the &#039;layout&#039; in the &#039;layouts&#039; array in the &#039;config.php&#039; file.  So if the order is (&#039;side-pre&#039;, &#039;side-post&#039;) and you want fake blocks to be in &#039;side-post&#039; change the &#039;defaultregion&#039; to &#039;side-post&#039; and the &#039;regions&#039; array to (&#039;side-post&#039;, &#039;side-pre&#039;).&lt;br /&gt;
&lt;br /&gt;
== Quiz &#039;secure&#039; pop-up ==&lt;br /&gt;
&lt;br /&gt;
When a quiz set to [[:en:Quiz_settings#Extra_restrictions_on_attempts|Full screen pop-up with some JavaScript security]] then the page uses a special &#039;secure&#039; layout template that should have minimal headers or links.&lt;br /&gt;
&lt;br /&gt;
== Readable fonts ==&lt;br /&gt;
&lt;br /&gt;
Are the fonts you have chosen readable?  Will they be difficult to read on small devices?&lt;br /&gt;
&lt;br /&gt;
== Right-to-left languages ==&lt;br /&gt;
&lt;br /&gt;
In languages like Hebrew or Farsi, lots of things that you made left-aligned probably need to be right-aligned instead. Moodle adds .dir-rtl or .dir-ltr class to the body element, which you can use in CSS rules.&lt;br /&gt;
&lt;br /&gt;
== Responsive ==&lt;br /&gt;
&lt;br /&gt;
Have you tested your theme for responsiveness on small devices?  Try resizing the browser window and see how it reacts.&lt;br /&gt;
&lt;br /&gt;
== Theme developer mode ==&lt;br /&gt;
&lt;br /&gt;
When &#039;Theme developer mode&#039; is &#039;on&#039;, all of the CSS files are sent individually.  When it is &#039;off&#039;, they are all combined together.  This can lead to some issues.  Check that your theme works with &#039;Theme designer mode off&#039;.&lt;br /&gt;
&lt;br /&gt;
== ... please add more things here in alphabetical order ... ==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43692</id>
		<title>Theme checklist</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43692"/>
		<updated>2014-02-01T15:24:35Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}So, you think your theme is finished? Well, Moodle is a big complex beast, and there are lots of obscure corners, that you might not know about. This page lists lots of things that you might have missed when working on your theme. To be sure your theme is really complete, you need to check these out.&lt;br /&gt;
&lt;br /&gt;
== Accessible colours ==&lt;br /&gt;
&lt;br /&gt;
Are the colours you have chosen accessible?  Is there a reasonable contrast difference between them?&lt;br /&gt;
&lt;br /&gt;
== All the different forms of the front page ==&lt;br /&gt;
&lt;br /&gt;
Depending on how many courses there are in your Moodle site, and how many of them the current user is enrolled in, the [[:en:Front_page|front page]] looks different. Have you tested all the different ways it can look?&lt;br /&gt;
&lt;br /&gt;
== Big report tables ==&lt;br /&gt;
&lt;br /&gt;
The [[:en:Gradebook|grader report]], and other similar reports like the quiz reports, are very big tables that don&#039;t fit on one screen. How does your theme cope. Is it easy for the teacher to scroll sideways to see all the data?&lt;br /&gt;
&lt;br /&gt;
== Fake blocks ==&lt;br /&gt;
&lt;br /&gt;
While you are looking at the quiz, pay attention to the [[:en:Using_Quiz|Quiz navigation block]]. This is not a normal block that teachers or admins can add or remove, it is a &#039;Fake block&#039; that looks like any other block but is part of the Moodle UI. Are you happy with where it appears, and how it looks?&lt;br /&gt;
&lt;br /&gt;
Other parts of Moodle that use fake blocks are the [[:en:Lesson_module|Lesson activity]] and [[:en:Calendar|the calendar UI]].&lt;br /&gt;
&lt;br /&gt;
Fake blocks are attached to the first region or the &#039;defaultregion&#039; in the &#039;regions&#039; array for the &#039;layout&#039; in the &#039;layouts&#039; array in the &#039;config.php&#039; file.  So if the order is (&#039;side-pre&#039;, &#039;side-post&#039;) and you want fake blocks to be in &#039;side-post&#039; change the &#039;defaultregion&#039; to &#039;side-post&#039; and the &#039;regions&#039; array to (&#039;side-post&#039;, &#039;side-pre&#039;).&lt;br /&gt;
&lt;br /&gt;
== Quiz &#039;secure&#039; pop-up ==&lt;br /&gt;
&lt;br /&gt;
When a quiz set to [[:en:Quiz_settings#Extra_restrictions_on_attempts|Full screen pop-up with some JavaScript security]] then the page uses a special &#039;secure&#039; layout template that should have minimal headers or links.&lt;br /&gt;
&lt;br /&gt;
== Readable fonts ==&lt;br /&gt;
&lt;br /&gt;
Are the fonts you have chosen readable?  Will they be difficult to read on small devices?&lt;br /&gt;
&lt;br /&gt;
== Right-to-left languages ==&lt;br /&gt;
&lt;br /&gt;
In languages like Hebrew or Farsi, lots of things that you made left-aligned probably need to be right-aligned instead. Moodle adds .dir-rtl or .dir-ltr class to the body element, which you can use in CSS rules.&lt;br /&gt;
&lt;br /&gt;
== Responsive ==&lt;br /&gt;
&lt;br /&gt;
Have you tested your theme for responsiveness on small devices?  Try resizing the browser window and see how it reacts.&lt;br /&gt;
&lt;br /&gt;
== ... please add more things here in alphabetical order ... ==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43691</id>
		<title>Theme checklist</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43691"/>
		<updated>2014-02-01T15:21:02Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}So, you think your theme is finished? Well, Moodle is a big complex beast, and there are lots of obscure corners, that you might not know about. This page lists lots of things that you might have missed when working on your theme. To be sure your theme is really complete, you need to check these out.&lt;br /&gt;
&lt;br /&gt;
== Accessible colours ==&lt;br /&gt;
&lt;br /&gt;
Are the colours you have chosen accessible?  Is there a reasonable contrast difference between them?&lt;br /&gt;
&lt;br /&gt;
== All the different forms of the front page ==&lt;br /&gt;
&lt;br /&gt;
Depending on how many courses there are in your Moodle site, and how many of them the current user is enrolled in, the [[:en:Front_page|front page]] looks different. Have you tested all the different ways it can look?&lt;br /&gt;
&lt;br /&gt;
== Big report tables ==&lt;br /&gt;
&lt;br /&gt;
The [[:en:Gradebook|grader report]], and other similar reports like the quiz reports, are very big tables that don&#039;t fit on one screen. How does your theme cope. Is it easy for the teacher to scroll sideways to see all the data?&lt;br /&gt;
&lt;br /&gt;
== Fake blocks ==&lt;br /&gt;
&lt;br /&gt;
While you are looking at the quiz, pay attention to the [[:en:Using_Quiz|Quiz navigation block]]. This is not a normal block that teachers or admins can add or remove, it is a &#039;Fake block&#039; that looks like any other block but is part of the Moodle UI. Are you happy with where it appears, and how it looks?&lt;br /&gt;
&lt;br /&gt;
Other parts of Moodle that use fake blocks are the [[:en:Lesson_module|Lesson activity]] and [[:en:Calendar|the calendar UI]].&lt;br /&gt;
&lt;br /&gt;
== Quiz &#039;secure&#039; pop-up ==&lt;br /&gt;
&lt;br /&gt;
When a quiz set to [[:en:Quiz_settings#Extra_restrictions_on_attempts|Full screen pop-up with some JavaScript security]] then the page uses a special &#039;secure&#039; layout template that should have minimal headers or links.&lt;br /&gt;
&lt;br /&gt;
== Readable fonts ==&lt;br /&gt;
&lt;br /&gt;
Are the fonts you have chosen readable?  Will they be difficult to read on small devices?&lt;br /&gt;
&lt;br /&gt;
== Right-to-left languages ==&lt;br /&gt;
&lt;br /&gt;
In languages like Hebrew or Farsi, lots of things that you made left-aligned probably need to be right-aligned instead. Moodle adds .dir-rtl or .dir-ltr class to the body element, which you can use in CSS rules.&lt;br /&gt;
&lt;br /&gt;
== Responsive ==&lt;br /&gt;
&lt;br /&gt;
Have you tested your theme for responsiveness on small devices?  Try resizing the browser window and see how it reacts.&lt;br /&gt;
&lt;br /&gt;
== ... please add more things here in alphabetical order ... ==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43690</id>
		<title>Theme checklist</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Theme_checklist&amp;diff=43690"/>
		<updated>2014-02-01T15:17:08Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}So, you think your theme is finished? Well, Moodle is a big complex beast, and there are lots of obscure corners, that you might not know about. This page lists lots of things that you might have missed when working on your theme. To be sure your theme is really complete, you need to check these out.&lt;br /&gt;
&lt;br /&gt;
== All the different forms of the front page ==&lt;br /&gt;
&lt;br /&gt;
Depending on how many courses there are in your Moodle site, and how many of them the current user is enrolled in, the [[:en:Front_page|front page]] looks different. Have you tested all the different ways it can look?&lt;br /&gt;
&lt;br /&gt;
== Big report tables ==&lt;br /&gt;
&lt;br /&gt;
The [[:en:Gradebook|grader report]], and other similar reports like the quiz reports, are very big tables that don&#039;t fit on one screen. How does your theme cope. Is it easy for the teacher to scroll sideways to see all the data?&lt;br /&gt;
&lt;br /&gt;
== Fake blocks ==&lt;br /&gt;
&lt;br /&gt;
While you are looking at the quiz, pay attention to the [[:en:Using_Quiz|Quiz navigation block]]. This is not a normal block that teachers or admins can add or remove, it is a &#039;Fake block&#039; that looks like any other block but is part of the Moodle UI. Are you happy with where it appears, and how it looks?&lt;br /&gt;
&lt;br /&gt;
Other parts of Moodle that use fake blocks are the [[:en:Lesson_module|Lesson activity]] and [[:en:Calendar|the calendar UI]].&lt;br /&gt;
&lt;br /&gt;
== Quiz &#039;secure&#039; pop-up ==&lt;br /&gt;
&lt;br /&gt;
When a quiz set to [[:en:Quiz_settings#Extra_restrictions_on_attempts|Full screen pop-up with some JavaScript security]] then the page uses a special &#039;secure&#039; layout template that should have minimal headers or links.&lt;br /&gt;
&lt;br /&gt;
== Right-to-left languages ==&lt;br /&gt;
&lt;br /&gt;
In languages like Hebrew or Farsi, lots of things that you made left-aligned probably need to be right-aligned instead. Moodle adds .dir-rtl or .dir-ltr class to the body element, which you can use in CSS rules.&lt;br /&gt;
&lt;br /&gt;
== ... please add more things here in alphabetical order ... ==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=42804</id>
		<title>Clean theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=42804"/>
		<updated>2013-10-31T14:28:21Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Getting started */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}{{Moodle 2.5}}This document describes how to copy and customise the Clean (bootstrapbase) theme so that you can build on this to create a theme of your own. It assumes you have some understanding of how themes work within Moodle 2.5, as well as a basic understanding of HTML and CSS. Also, because of the rapid development within Moodle, resulting in a number of versions available namely 2.3.x and 2.4.x, and 2.5.x it is important to understand that this tutorial is only valid for the Moodle 2.5+ Clean theme.&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
From your Moodle &#039;&#039;&#039;theme&#039;&#039;&#039; directory &#039;&#039;&#039;right click&#039;&#039;&#039; on the &#039;&#039;&#039;clean&#039;&#039;&#039; theme and then &#039;&#039;&#039;&#039;&#039;copy&#039;&#039;&#039; and  &#039;&#039;&#039;paste&#039;&#039;&#039;&#039;&#039; back into your Moodle &#039;&#039;&#039;theme&#039;&#039;&#039; directory. You should now have a folder called &#039;&#039;&#039;Copy of clean&#039;&#039;&#039;. If you &#039;&#039;&#039;right click&#039;&#039;&#039; this folder you are given the option to &#039;&#039;&#039;Rename&#039;&#039;&#039; it. So rename this folder to your choosen theme name, using only lower case letters, and if needed, underscores. For the purpose of this tutorial we will call the theme &#039;cleantheme&#039;.&lt;br /&gt;
&lt;br /&gt;
On opening &#039;cleantheme&#039; you will find several files and sub-directories which have files within them.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
; config.php :  Where all the theme configurations are made. &#039;&#039;(contains some elements that require renaming)&#039;&#039;&lt;br /&gt;
; lib.php :  Where all the functions for the themes settings are found. &#039;&#039;(contains some elements that require renaming)&#039;&#039;&lt;br /&gt;
; settings.php :  Where all the setting for this theme are created. &#039;&#039;(contains some elements that require renaming)&#039;&#039;&lt;br /&gt;
; version.php :  Where the version number and plugin componant information is kept. &#039;&#039;(contains some elements that require renaming)&#039;&#039;&lt;br /&gt;
; /lang/ : This directory contains all language sub-directories for other languages if and when you want to add them.&lt;br /&gt;
; /lang/en/ : This sub-directory contains your language files, in this case &#039;&#039;English&#039;&#039;.&lt;br /&gt;
; /lang/en/theme_clean.php : This file contains all the language strings for your theme. &#039;&#039;(contains some elements that require renaming as well as the filename itself)&#039;&#039;  &lt;br /&gt;
; /layout/ : This directory contains all the layout files for this theme.&lt;br /&gt;
; /layout/columns1.php : Layout file for a one column layout (content only).&lt;br /&gt;
; /layout/columns2.php : Layout file for a two column layout (side-pre and content).&lt;br /&gt;
; /layout/columns3.php : Layout file for a three column layout (side-pre, content and side-post) and the front page.&lt;br /&gt;
; /layout/embedded.php : Embedded layout file for embeded pages, like iframe/object embeded in moodleform - it needs as much space as possible.&lt;br /&gt;
; /layout/maintenance.php : Maintenance layout file which does not have any blocks, links, or API calls that would lead to database or cache interaction.&lt;br /&gt;
; /layout/secure.php : Secure layout file for safebrowser and securewindow.&lt;br /&gt;
; /style/ : This directory contains all the CSS files for this theme.&lt;br /&gt;
; /style/custom.css : This is where all the settings CSS is generated.&lt;br /&gt;
; /pix/ : This directory contains a screen shot of this theme as well as a favicon and any images used in the theme.&lt;br /&gt;
&lt;br /&gt;
==Renaming Elements==&lt;br /&gt;
&lt;br /&gt;
The problem when &#039;&#039;&#039;cloning&#039;&#039;&#039; a theme is that you need to rename all those instances where the old theme name occurs, in this case &#039;&#039;&#039;clean&#039;&#039;&#039;. So using the above list as a guide, search through and change all the instances of the theme name &#039;clean&#039; to &#039;cleantheme&#039;. This includes the filename of the lang/en/theme_clean.php. You need to change this to &#039;theme_cleantheme.php&#039;.&lt;br /&gt;
&lt;br /&gt;
==Installing your theme==&lt;br /&gt;
&lt;br /&gt;
Once all the changes to the name have been made, you can safely install the theme. If you are already logged in just refreshing the browser should trigger your Moodle site to begin the install &#039;Plugins Check&#039;. If not then navigate to Administration &amp;gt; Notifications.&lt;br /&gt;
&lt;br /&gt;
Once your theme is successfully installed you can select it and begin to modify it using the custom settings page found by navigating to Administration &amp;gt; Site Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt;&amp;gt; and then click on (Cleantheme) or whatever you renamed your theme to, from the list of theme names that appear at this point in the side block.&lt;br /&gt;
&lt;br /&gt;
==Include a renderer in a bootstrap based theme==&lt;br /&gt;
&lt;br /&gt;
If you need to override any renderers in your theme, then make sure you override the renderers from the bootstrap theme, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
class theme_overridetest_core_renderer extends theme_bootstrapbase_core_renderer {&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(The normal recipe &amp;lt;tt&amp;gt;class theme_overridetest_core_renderer extends core_renderer&amp;lt;/tt&amp;gt; is wrong for bootstrap-based themes.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [http://www.somerandomthoughts.com/blog/2013/05/08/moodle-2-5-and-the-bootstrap-based-theme-clean/ Moodle 2.5 and the Bootstrap based theme – Clean] blog post by Gavin Henrick&lt;br /&gt;
* [http://basbrands.nl/blog/2013/05/21/building-with-bootstrap/ Building With Bootstrap] blog post by Bas Brands&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=XMLDB_editor&amp;diff=42486</id>
		<title>XMLDB editor</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=XMLDB_editor&amp;diff=42486"/>
		<updated>2013-10-02T11:40:38Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Fix incorrect navigation.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Site administration &amp;gt; Development &amp;gt; XMLDB editor&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The XMLDB editor is a tool for making the .xml files that specify how moodle should set up its database tables. Previously, developers had to make separate .sql install files for mysql and postgres, but now only database-neutral file is needed, which supports many more databases.&lt;br /&gt;
&lt;br /&gt;
*It makes the editing of tables/fields/keys/indexes almost a trivial task, allowing developers to spend  the time coding and improving things instead of fighting with XML files and the errors caused by manual editing (of course, developers are free to use such extra time as desired - beers, dance, books, music...) ;-)&lt;br /&gt;
&lt;br /&gt;
*All new &#039;&#039;install.xml&#039;&#039; files present under each &#039;&#039;db&#039;&#039; directory in Moodle can be edited (and we recommend it) with just some clicks and keystrokes. Those &#039;&#039;install.xml&#039;&#039; will contain all the info needed to generate the specific objects needed for each RDBMS supported. &lt;br /&gt;
&lt;br /&gt;
*Note: To be able to handle files properly, the web server needs write access to all &#039;&#039;db&#039;&#039; directories where the &#039;&#039;install.xml&#039;&#039; files reside (and to the files themselves, of course). If you cannot click either the load or create link, that means that you either have not created the /db directory, or that it is not writeable by the webserver.&lt;br /&gt;
&lt;br /&gt;
== Quick Start ==&lt;br /&gt;
&lt;br /&gt;
To use the XMLDB editor to create tables for a new plugin:&lt;br /&gt;
&lt;br /&gt;
# Under your plugin&#039;s directory, create a &#039;&#039;&#039;&amp;lt;code&amp;gt;db&amp;lt;/code&amp;gt;&#039;&#039;&#039; directory, e.g. &#039;&#039;&#039;&amp;lt;code&amp;gt;mod/mymodule/db&amp;lt;/code&amp;gt;&#039;&#039;&#039;. Make sure the web server has write access to this directory.&lt;br /&gt;
# In Moodle, navigate to Site administration-&amp;gt;Development-&amp;gt;XMLDB editor&lt;br /&gt;
# You should now see &#039;&#039;&#039;&amp;lt;code&amp;gt;mod/mymodule/db&amp;lt;/code&amp;gt;&#039;&#039;&#039; in the list of XMLDB locations, and the &#039;&#039;&#039;Create&#039;&#039;&#039; link should now be clickable. (If you see your directory but none of the links are clickable, make sure the web server has write access to this directory!)&lt;br /&gt;
# Click &#039;&#039;&#039;Create&#039;&#039;&#039;. (This will create a blank install.xml file)&lt;br /&gt;
# Click &#039;&#039;&#039;Load&#039;&#039;&#039;. (This will load the contents of the install.xml file into memory)&lt;br /&gt;
# Click &#039;&#039;&#039;Edit&#039;&#039;&#039;.&lt;br /&gt;
# Now you can actually use the XMLDB editor, to create and edit tables for your plugin.&lt;br /&gt;
# When you&#039;re done, keep clicking &#039;&#039;&#039;Back&#039;&#039;&#039; and &#039;&#039;&#039;Back to Main&#039;&#039;&#039; until you get back to the list of XMLDB locations, and then click &#039;&#039;&#039;Save&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This will create an &#039;&#039;install.xml&#039;&#039; file, which can be used to load your tables into the database in conjunction with a &#039;&#039;version.php&#039;&#039; file. See [[Installing_and_upgrading_plugin_database_tables]] for more information.&lt;br /&gt;
&lt;br /&gt;
After the initial installation of a plugin, for subsequent updates to the plugin&#039;s table structure you&#039;ll need to manually create an &#039;&#039;upgrade.php&#039;&#039; file in your module&#039;s &#039;&#039;db&#039;&#039; folder. The &#039;&#039;upgrade.php&#039;&#039; file should start off looking something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
function xmldb_mymodule_upgrade($oldversion) {&lt;br /&gt;
    global $CFG;&lt;br /&gt;
&lt;br /&gt;
    $result = TRUE;&lt;br /&gt;
&lt;br /&gt;
// Insert PHP code from XMLDB Editor here&lt;br /&gt;
&lt;br /&gt;
    return $result;&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get the code for the &#039;// Insert PHP code here&#039; bit, open the XMLDB Editor and load the relevant &#039;&#039;install.xml&#039;&#039; file. Choose the &#039;View PHP&#039; option and then copy and paste the generated code.&lt;br /&gt;
&lt;br /&gt;
== Use==&lt;br /&gt;
&lt;br /&gt;
*The XMLDB editor is pretty easy to use so there&#039;s no need for a complete guide here. Playing with it for a while is highly recommended, viewing how it works and how it modifies the &#039;&#039;install.xml&#039;&#039; files.&lt;br /&gt;
&lt;br /&gt;
*It&#039;s organised in a top-bottom structure, where you start &#039;&#039;loading&#039;&#039;&#039; (or &#039;&#039;creating&#039;&#039;) a new XMLDB file. Then, you can &#039;&#039;edit&#039;&#039; the file and its &#039;&#039;general structure&#039;&#039; will be shown. This structure has two types of elements, &#039;&#039;tables&#039;&#039; and &#039;&#039;statements&#039;&#039; and the XMLDB editor allows you to &#039;&#039;add&#039;&#039;, &#039;&#039;edit&#039;&#039;, &#039;&#039;delete&#039;&#039;, and &#039;&#039;move&#039;&#039; them easily. Also, for initial creation of tables, one small but effective &#039;&#039;&#039;reverse-enginery&#039;&#039;&#039; tool has been developed (only under MySQL) allowing you to retrofit any table from the DB to the XMLDB Editor.&lt;br /&gt;
&lt;br /&gt;
*Whilst editing tables you will see their &#039;&#039;fields&#039;&#039;, &#039;&#039;keys&#039;&#039; and &#039;&#039;indexes&#039;&#039; and you&#039;ll be able to handle all them easily. Note that some fields can be non-editable. This is because they are being used in some way (part of one key or index) and the idea is to warn you about that.&lt;br /&gt;
&lt;br /&gt;
*Fields can be edited and you can specify their &#039;&#039;name&#039;&#039;, &#039;&#039;type&#039;&#039;, &#039;&#039;length&#039;&#039;, &#039;&#039;decimals&#039;&#039;, &#039;&#039;null-ability&#039;&#039;, &#039;&#039;defaults&#039;&#039; and so on. Exactly the same for both &#039;&#039;keys&#039;&#039; and &#039;&#039;indexes&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*Whilst editing statements, you must think about them like &amp;quot;collections of sentences&amp;quot;. Once you select the &#039;&#039;type&#039;&#039; (only inserts are allowed for now) and &#039;&#039;table&#039;&#039; you are interested in, you&#039;ll be able to introduce the exact values easily, being able to &#039;&#039;duplicate&#039;&#039; them easily to gain some speed if you have a lot of sentences in your development. Sentences can be &#039;&#039;edited&#039;&#039; and &#039;&#039;deleted&#039;&#039; easily too.&lt;br /&gt;
&lt;br /&gt;
*One interesting feature is that all the XMLDB editor pages allow you to enter a &#039;&#039;comment&#039;&#039; about the item being modified (table, index, key, field, statement). Use it as you wish, sure that it helps other developers to understand a bit more about the DB model.&lt;br /&gt;
&lt;br /&gt;
*If you define a field as an &#039;&#039;&#039;enum&#039;&#039;&#039;, you should provide the enum options as a comma-separated list, with each option surrounded by single quotes. Example: &#039;&#039;&#039;&amp;lt;code&amp;gt;&#039;option1&#039;,&#039;option2&#039;,&#039;option3&#039;&amp;lt;/code&amp;gt;&#039;&#039;&#039;. However, enum has been deprecated in Moodle 2.0, so it is probably better just to avoid enum types altogether.&lt;br /&gt;
&lt;br /&gt;
== Conventions ==&lt;br /&gt;
&lt;br /&gt;
Apart from the [[Database| Database Structures guidelines]], some more conventions should be followed:&lt;br /&gt;
&lt;br /&gt;
# About names:&lt;br /&gt;
## All lowercase names (tables, indexes, keys and fields).&lt;br /&gt;
## Table names and field names must use only a-z, 0-9 and _ chars. Max 28 characters.&lt;br /&gt;
## Key and index names under the XMLDB Files must be formed by concatenating the name of the fields present in the key/index with the &#039;&amp;quot;-&amp;quot; (minus) character.&lt;br /&gt;
## Primary key always must be named &amp;quot;primary&amp;quot; (this is one exception to the previous convention).&lt;br /&gt;
## It&#039;s highly recommended to avoid [[XMLDB_reserved_words|reserved words]] completely. We know we have some of them now but they should be completely out for next releases.&lt;br /&gt;
# About NULLS&lt;br /&gt;
## Avoid to create all the fields as NOT NULL with the &#039;&#039;silly&#039;&#039; default value &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt; (empty string). The underlying code used to create tables will handle it properly but the XMLDB structure must be REAL. Read more in the [[XMLDB Problems#NOT NULL fields using a DEFAULT &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt; clause|Problems Page]].&lt;br /&gt;
# About FOREIGN KEYS&lt;br /&gt;
## Under the tables of every XMLDB file, you must define the existing &#039;&#039;&#039;Foreign Keys&#039;&#039;&#039; (FK) properly. This will allow everybody to know a bit better the structure, allow to evolve to a better constrained system in the future and will provide the underlying code with the needed info to create the proper indexes. &lt;br /&gt;
## Note that, if you define any field combination as FK you won&#039;t have to create any index on that fields, the code will do it automatically! &lt;br /&gt;
## This convention is only applicable for relations INSIDE one file. Don&#039;t generate FK constraints against other files (courseid, userid), use indexes there.&lt;br /&gt;
## Respect Convention 1.3&lt;br /&gt;
# About UNIQUE KEYS&lt;br /&gt;
## Declare any fields as UNIQUE KEY (UK) only if they are going to be used as target for one FK. Create unique indexes instead.&lt;br /&gt;
## Respect Convention 1.3&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[XMLDB defining an XML structure]]&lt;br /&gt;
*[[Installing and upgrading plugin database tables]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=82231 Using XMLDB editor] forum discussion&lt;br /&gt;
* [http://dev.moodle.org/mod/resource/view.php?id=55 Appendix B - The XMLDB Editor] from the Introduction to Moodle Programming course&lt;br /&gt;
&lt;br /&gt;
[[Category:XMLDB]]&lt;br /&gt;
[[Category:DB]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=YUI/Shifter&amp;diff=42281</id>
		<title>YUI/Shifter</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=YUI/Shifter&amp;diff=42281"/>
		<updated>2013-09-08T14:28:48Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* What is Shifter and what does it do? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is Shifter and what does it do? ==&lt;br /&gt;
&lt;br /&gt;
[http://yui.github.com/shifter Shifter] is a tool written by the YUI team to help &#039;&#039;build&#039;&#039; YUI modules.&lt;br /&gt;
It has been supported since Moodle 2.5 and we encourage it&#039;s use.&lt;br /&gt;
&lt;br /&gt;
It is written in JavaScript itself, and written as a [http://nodejs.org Node.JS] module which can be installed from [https://npmjs.org/package/shifter NPM].&lt;br /&gt;
&lt;br /&gt;
Shifter takes your source JavaScript file(s), along with some meta-data, and wraps it all together into a built file. This file is known in YUI parlance as a &#039;&#039;&#039;module&#039;&#039;&#039;.&lt;br /&gt;
After building this file, Shifter then produces three versions:&lt;br /&gt;
* the file in it&#039;s original form (DEBUG - &#039;-debug&#039; filename postfix);&lt;br /&gt;
* the DEBUG file with all debugging calls to Y.Log removed (RAW - no filename postfix); and&lt;br /&gt;
* the RAW file minified using [https://github.com/mishoo/UglifyJS UglifyJS] (&#039;-min&#039; filename postfix).&lt;br /&gt;
&lt;br /&gt;
The meta-data file includes information on the module name, and it&#039;s dependencies on other modules.&lt;br /&gt;
&lt;br /&gt;
By separating out the actual JS code from it&#039;s dependencies, we are able to take those dependencies and use them elsewhere in Moodle.&lt;br /&gt;
As an example, this dependency data can be used to inform the Loading system to reduce the number of HTTP requests with Combo Loading. This has a benefical effect upon performance.&lt;br /&gt;
&lt;br /&gt;
Another feature of Shifter is it&#039;s ability to handle &#039;&#039;rollups&#039;&#039;. Rollups describe the inclusion of multiple YUI classes in the same module. This means that you can have different but related components all in the same module, but without having a single large and less-managable source file.&lt;br /&gt;
&lt;br /&gt;
=== Why do I need build my modules? ===&lt;br /&gt;
&lt;br /&gt;
Technically you don&#039;t, and you can continue to use the old data structure, but by doing so you can benefit from:&lt;br /&gt;
* reduced data sent over the wire due to minification - great for slower connections and mobile devices;&lt;br /&gt;
* reduced number of http queries - the separation of module meta-data means that it can be consumed and fed into the Loader allowing your module to use combo-loading;&lt;br /&gt;
* a slightly simplified JS syntax for your source files.&lt;br /&gt;
&lt;br /&gt;
== Installing Shifter ==&lt;br /&gt;
&lt;br /&gt;
Shifter is written in JavaScript and the [http://nodejs.org Node.JS] environment. You will need to install Node.JS first. This is usually fairly easy as there are pre-built binary packages for &#039;&#039;&#039;Windows and Mac OS&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After installing Node.JS you then use the Node NPM tool to install Shifter:&lt;br /&gt;
   npm install shifter@0.3.1 -g&lt;br /&gt;
&lt;br /&gt;
Note: At present, the supported version of Shifter for use in Moodle is version &#039;&#039;0.3.1&#039;&#039;. You are not &#039;&#039;required&#039;&#039; to run a specific version of Shifter, but this is the version that Moodle YUI modules will be built with and you may find it beneficial to do so too.&lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;Ubuntu&#039;&#039;&#039; run:&lt;br /&gt;
&lt;br /&gt;
   sudo apt-get install npm&lt;br /&gt;
   sudo apt-get install python-software-properties python g++ make&lt;br /&gt;
   sudo apt-get update&lt;br /&gt;
   sudo apt-get install nodejs&lt;br /&gt;
   sudo ln -s /usr/bin/nodejs /usr/local/bin/node&lt;br /&gt;
   sudo npm install shifter@0.3.1 -g&lt;br /&gt;
&lt;br /&gt;
== How do I write a YUI module which uses Shifter? ==&lt;br /&gt;
&lt;br /&gt;
Easy - it&#039;s mostly just a case of building the right directory structure.&lt;br /&gt;
&lt;br /&gt;
Assuming that you are creating a new YUI module in your block named fruit, and that your new YUI module will be called fruitbowl, we know the following:&lt;br /&gt;
{|&lt;br /&gt;
|Plugin type&lt;br /&gt;
|block&lt;br /&gt;
|-&lt;br /&gt;
|Plugin name&lt;br /&gt;
|fruit&lt;br /&gt;
|-&lt;br /&gt;
|Plugin frankenstyle name&lt;br /&gt;
|block_fruit&lt;br /&gt;
|-&lt;br /&gt;
|YUI Module name&lt;br /&gt;
|moodle-block_fruit-fruitbowl&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This means that your Moodle plugin directory is:&lt;br /&gt;
  /blocks/fruit&lt;br /&gt;
&lt;br /&gt;
And your &#039;&#039;fruitbowl&#039;&#039; YUI module source will therefore be in:&lt;br /&gt;
  /blocks/fruit/yui/src/fruitbowl&lt;br /&gt;
&lt;br /&gt;
The overall module directory structure looks like this:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
yui/&lt;br /&gt;
|-- src&lt;br /&gt;
    |-- fruitbowl&lt;br /&gt;
        |-- build.json&lt;br /&gt;
        |-- js&lt;br /&gt;
        |   |-- fruitbowl.js&lt;br /&gt;
        |-- meta&lt;br /&gt;
            |-- fruitbowl.json&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== build.json ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;build.json&#039;&#039; file defines the eventual modules which will be built, and the source files that you&#039;ve written:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;name&amp;quot;: &amp;quot;moodle-block_fruit-fruitbowl&amp;quot;,&lt;br /&gt;
  &amp;quot;builds&amp;quot;: {&lt;br /&gt;
    &amp;quot;moodle-block_fruit-fruitbowl&amp;quot;: {&lt;br /&gt;
      &amp;quot;jsfiles&amp;quot;: [&lt;br /&gt;
        &amp;quot;fruitbowl.js&amp;quot;&lt;br /&gt;
      ]&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== meta/MODNAME.json ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;meta/MODNAME.json&#039;&#039; file describes the list of dependencies for each module:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;moodle-block_fruit-fruitbowl&amp;quot;: {&lt;br /&gt;
    &amp;quot;requires&amp;quot;: [&lt;br /&gt;
        &amp;quot;base&amp;quot;,&lt;br /&gt;
        &amp;quot;node&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== js/MODNAME.js ===&lt;br /&gt;
&lt;br /&gt;
The files in the js directory are the contents of your YUI module. This should include setting it up in the &#039;&#039;&#039;&#039;&#039;M&#039;&#039;&#039;&#039;&#039; namespace. As an example of a very basic structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
M.block_fruit = M.block_fruit || {};&lt;br /&gt;
M.block_fruit.fruitbowl = {&lt;br /&gt;
  init: function() {&lt;br /&gt;
    Y.one(&#039;#example&#039;).set(&#039;innerHTML&#039;, &#039;Example content&#039;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How do I use shifter? ==&lt;br /&gt;
&lt;br /&gt;
So after writing out your structure, you now need to build it into a module. After installing Shifter, you have several options.&lt;br /&gt;
&lt;br /&gt;
=== During development ===&lt;br /&gt;
&lt;br /&gt;
A really nice way of running shifter during development is to have it detect changes to your files as you save them:&lt;br /&gt;
&lt;br /&gt;
  cd ~/git/moodle/blocks/fruit/src&lt;br /&gt;
  shifter --watch&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;--watch&#039;&#039;&#039; option will watch for any changes to JS, JSON, CSS, or images within any module in the current directory and build that module when it detects changes.&lt;br /&gt;
&#039;&#039;Note: There can be a short delay of a few seconds while the changes are discovered and the file is built&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is great for development because you don&#039;t have to continously run shifter manually.&lt;br /&gt;
&lt;br /&gt;
=== All YUI modules for the Moodle plugin you&#039;re currently working on ===&lt;br /&gt;
&lt;br /&gt;
If you are working on several YUI modules at once, then you can have shifter build all of them at the same time:&lt;br /&gt;
&lt;br /&gt;
  cd ~/git/moodle/blocks/fruit/src&lt;br /&gt;
  shifter --walk&lt;br /&gt;
&lt;br /&gt;
=== Just the module you&#039;re working on now ===&lt;br /&gt;
If you want to build just the module you&#039;re working on at the moment:&lt;br /&gt;
&lt;br /&gt;
  cd ~/git/moodle/blocks/fruit/src&lt;br /&gt;
  shifter --walk fruitbowl&lt;br /&gt;
&lt;br /&gt;
Or:&lt;br /&gt;
&lt;br /&gt;
  cd ~/git/moodle/blocks/fruit/src/fruitbowl&lt;br /&gt;
  shifter&lt;br /&gt;
&lt;br /&gt;
=== Across the whole of Moodle ===&lt;br /&gt;
If you want to build every YUI module in Moodle at once:&lt;br /&gt;
&lt;br /&gt;
  cd ~/git/moodle&lt;br /&gt;
  shifter --walk --recursive&lt;br /&gt;
&lt;br /&gt;
== Submitting my JavaScript back to Moodle core ==&lt;br /&gt;
&lt;br /&gt;
If you&#039;re working on some JavaScript for Moodle core, either in the form of a bug fix or a new feature, then you probably want to know what to do with your built module.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;We ask that you build your module and submit both the changes to tbe built module and the source directory.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In addition, the Continuous Integration server (Jenkins) will run &#039;&#039;shifter --walk --recursive&#039;&#039; on every run to ensure that all built files are up-to-date and correct.&lt;br /&gt;
&lt;br /&gt;
If there are several commits to the same YUI module within a single period of Moodle integration, then the built files will conflict. In this case the integration team will manually build the module and resolve the conflict. If you are aware that there may be multiple changes to the same file, please indicate this when submitting your change for Integration Review. If you are familiar with the changes, you may wish to consider building the issues upon one another too.&lt;br /&gt;
&lt;br /&gt;
== How do I convert my existing module? ==&lt;br /&gt;
&lt;br /&gt;
If you already have an existing moodle YUI module and want to convert it to the new Shifter format, then it&#039;s pretty easy on the whole:&lt;br /&gt;
&lt;br /&gt;
# create a new src/MODNAME directory;&lt;br /&gt;
# create js and meta directories within this;&lt;br /&gt;
# copy over your existing js file into the js directory;&lt;br /&gt;
# extract the meta-data;&lt;br /&gt;
# write your build.json;&lt;br /&gt;
# remove the YUI.add() wrapper from the top and bottom of your js file; and&lt;br /&gt;
# remove the old file.&lt;br /&gt;
&lt;br /&gt;
To create the complete directory structure and copy your existing code into the right directory (steps 1 - 3):&lt;br /&gt;
&lt;br /&gt;
  mkdir -p src/MODNAME/{js,meta}&lt;br /&gt;
  cp MODNAME/MODNAME.js src/MODNAME/js/&lt;br /&gt;
&lt;br /&gt;
Refer to the section above on the correct contents of the build.json and meta/MODNAME.json files.&lt;br /&gt;
&lt;br /&gt;
== Can I run my shifted module in older versions of Moodle 2? ==&lt;br /&gt;
&lt;br /&gt;
We are aware that many developers wish to reduce the overhead of maintaining a plugin for multiple versions of Moodle and that using Shifter will make this much harder. Unfortunately you can&#039;t use the shifted version of your module directly, but you can run them in parallel by copying the built file into the old directory structure.&lt;br /&gt;
&lt;br /&gt;
Moodle will always &#039;&#039;prefer&#039;&#039; the built shifted module over the older style module if both are present.&lt;br /&gt;
&lt;br /&gt;
If doing this, we would recommend copying over the minified version of your file so that older versions of moodle benefit from your user of shifted code.&lt;br /&gt;
&lt;br /&gt;
On a Linux-like operating system, you can use the following (again with our fruit example):&lt;br /&gt;
  cp yui/build/moodle-mod_fruit-fruitbowl/moodle-mod_fruit-fruitbowl-min.js yui/fruitbowl/fruitbowl.js&lt;br /&gt;
&lt;br /&gt;
Whilst developing, you may want to use a symlink so that you don&#039;t have to keep copying your changes after building them:&lt;br /&gt;
  ln -s yui/build/moodle-mod_fruit-fruitbowl/moodle-mod_fruit-fruitbowl.js yui/fruitbowl/fruitbowl.js&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[JavaScript guidelines]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=YUI/Modules&amp;diff=41216</id>
		<title>YUI/Modules</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=YUI/Modules&amp;diff=41216"/>
		<updated>2013-07-06T16:25:43Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Including your module from your PHP code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{draft}}&lt;br /&gt;
{{Work in progress}}&lt;br /&gt;
{{Moodle 2.5}}&lt;br /&gt;
&lt;br /&gt;
== YUI modules ==&lt;br /&gt;
&lt;br /&gt;
You may want to [[#Additional_functions_instead_of_anonymous_functions|Jump straight to the complete example]].&lt;br /&gt;
&lt;br /&gt;
=== What is a module and why would I want to use one? ===&lt;br /&gt;
&lt;br /&gt;
Many people are used to writing their JavaScript code either inline, or in a&lt;br /&gt;
separate file included using &amp;lt;script&amp;gt; tags in their HTML. Although both of&lt;br /&gt;
these are supported within Moodle, we highly recommend investing a little&lt;br /&gt;
time in looking into the [[YUI]] module system as it offers some really great&lt;br /&gt;
features which will benefit you in the long run.&lt;br /&gt;
&lt;br /&gt;
These features and benefits include:&lt;br /&gt;
* a host of existing modules that you can hook into and use; which offer&lt;br /&gt;
* code sandboxing to ensure that you always have a good/clean copy of the code; with&lt;br /&gt;
* powerful dependency management; which can utilise&lt;br /&gt;
* asynchronous loading to load dependencies in parallel; and&lt;br /&gt;
* loading of dependencies in any order (you don&#039;t have to include script tags in a set order); and&lt;br /&gt;
* separation of loading from execution; and&lt;br /&gt;
* combo loading to reduce the number of individual HTTP transactions.&lt;br /&gt;
&lt;br /&gt;
By using existing modules in your code, you can benefit in other ways too, such as:&lt;br /&gt;
* a consistent look and feel across Moodle; and&lt;br /&gt;
* most of the edge cases already catered for.&lt;br /&gt;
&lt;br /&gt;
The Moodle community is in the process of improving much of its JavaScript&lt;br /&gt;
in areas such as code, documentation, and processes. This includes updating&lt;br /&gt;
older code, adding documentation, seeding dependency information for&lt;br /&gt;
modules to improve load efficiency for browsers, and much more.&lt;br /&gt;
&lt;br /&gt;
You may find the following resources particularly helpful:&lt;br /&gt;
* [[YUI]]; and&lt;br /&gt;
* [[Javascript/Shifter]].&lt;br /&gt;
&lt;br /&gt;
=== Structure and naming ===&lt;br /&gt;
&lt;br /&gt;
A YUI module is structured in a particular way, both on file, and in the&lt;br /&gt;
file itself. Before you start writing your module, you need to know a few&lt;br /&gt;
bits of information:&lt;br /&gt;
* what is the [[Frankenstyle]] name of your Moodle plugin;&lt;br /&gt;
* what does your YUI module do in a single word.&lt;br /&gt;
&lt;br /&gt;
You can use these pieces of information to work out the namespace for your&lt;br /&gt;
plugin. This namespace fits into the template:&lt;br /&gt;
&lt;br /&gt;
  moodle-FRANKENSTYLE-MODULENAME&lt;br /&gt;
&lt;br /&gt;
As an example, writing a plugin for the fictional &#039;&#039;&#039;&#039;fruit&#039;&#039;&#039;&#039; &#039;&#039;&#039;block&#039;&#039;&#039; which&lt;br /&gt;
offers fruit to users:&lt;br /&gt;
* you may decide to call this module the &#039;&#039;&#039;&#039;fruitbowl&#039;&#039;&#039;&#039; as the module offers fruit to users, and presents it in an appealing way so that they can see it.&lt;br /&gt;
* The block is fruit, therefore the frankenstyle name is block_fruit.&lt;br /&gt;
&lt;br /&gt;
Therefor the name for this module will be:&lt;br /&gt;
&lt;br /&gt;
    moodle-block_fruit-fruitbowl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The other thing that you need to know in order to create your first module&lt;br /&gt;
is where in your plugin the code needs to be.&lt;br /&gt;
&lt;br /&gt;
As described in the [[Javascript/Shifter#How_do_I_write_a_YUI_module_which_uses_Shifter.3F]] documentation, the code will need to go in your plugin directory inside a yui directory.&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.5, the structure for this directory is:&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
yui/&lt;br /&gt;
|-- src&lt;br /&gt;
    |-- fruitbowl&lt;br /&gt;
        |-- build.json&lt;br /&gt;
        |-- js&lt;br /&gt;
        |   |-- fruitbowl.js&lt;br /&gt;
        |-- meta&lt;br /&gt;
            |-- fruitbowl.json&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039;Note: Moodle 2.5 onwards is backwards compatibly with the previous structure.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So in the case of moodle-block_fruit-fruitbowl, the JavaScript code will need to go into:&lt;br /&gt;
    /block/fruit/yui/src/fruitbowl/js/fruitbowl.js&lt;br /&gt;
&lt;br /&gt;
(Sorry, it does look a little more complicated than it really is)&lt;br /&gt;
&lt;br /&gt;
See the notes in the [[Javascript/Shifter#How_do_I_write_a_YUI_module_which_uses_Shifter.3F|Shifter]] documentation for details on the build.json and meta/MODULENAME.json file contents.&lt;br /&gt;
&lt;br /&gt;
Now that you know where your code needs to be on disk, you can actually include and write it.&lt;br /&gt;
&lt;br /&gt;
=== Including your module from your PHP code ===&lt;br /&gt;
&lt;br /&gt;
Rather than using &amp;lt;script&amp;gt; tags to include JavaScript code, Moodle makes&lt;br /&gt;
use of the YUI loader and a single inline script tag in the page footer.&lt;br /&gt;
&lt;br /&gt;
Moving JavaScript to a page footer is important to the perceived performance of a page, and the YUI loader helps further.&lt;br /&gt;
&lt;br /&gt;
The YUI loader also intelligiently loads page dependencies, in as few&lt;br /&gt;
requests as possible by making use of a combo-loader system.&lt;br /&gt;
It will also attempt to use the appropriate version of your JavaScript&lt;br /&gt;
depending on your $CFG-&amp;gt;jsrev settings. In normal operation, a minified&lt;br /&gt;
version of your code is used; and with $CFG-&amp;gt;jsrev is set to a value of&lt;br /&gt;
&#039;-1&#039; or $CFG-&amp;gt;cachejs is false, then a debugging version is used.&lt;br /&gt;
&lt;br /&gt;
To ensure that your module is loaded, there is a &#039;&#039;&#039;yui_module()&#039;&#039;&#039;&lt;br /&gt;
function on the page requirements class. This can be accessed using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$PAGE-&amp;gt;requires-&amp;gt;yui_module();&lt;br /&gt;
// or:&lt;br /&gt;
$this-&amp;gt;page-&amp;gt;requires-&amp;gt;yui_module();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The yui_module function takes the module name, and the init function to&lt;br /&gt;
call as it&#039;s first two arguments, and an optional list of arguments as a&lt;br /&gt;
third argument:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$PAGE-&amp;gt;requires-&amp;gt;yui_module(&#039;moodle-block_fruit-fruitbowl&#039;,&lt;br /&gt;
        &#039;M.block_fruit.fruitbowl.init&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Passing arguments from your PHP to your module ====&lt;br /&gt;
&lt;br /&gt;
You may want to pass a set of arguments to your JavaScript. You can do so&lt;br /&gt;
using the optional third argument to yui_module which accepts an array of&lt;br /&gt;
arguments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$PAGE-&amp;gt;requires-&amp;gt;yui_module(&#039;moodle-block_fruit-fruitbowl&#039;,&lt;br /&gt;
        &#039;M.block_fruit.fruitbowl.init&#039;,&lt;br /&gt;
        array(&lt;br /&gt;
            &#039;value1&#039;,&lt;br /&gt;
            &#039;value2&#039;,&lt;br /&gt;
        ));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These will be presented to the JavaScript function you name:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
init = function(argument1, argument2) {&lt;br /&gt;
    // Use the arguments here.&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often it makes more sense to pass a single argument with an associative array:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$PAGE-&amp;gt;requires-&amp;gt;yui_module(&#039;moodle-block_fruit-fruitbowl&#039;,&lt;br /&gt;
        &#039;M.block_fruit.fruitbowl.init&#039;,&lt;br /&gt;
        array(array(&lt;br /&gt;
            &#039;key1&#039; =&amp;gt; &#039;value1&#039;,&lt;br /&gt;
            &#039;key2&#039; =&amp;gt; &#039;value2&#039;,&lt;br /&gt;
        )));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These will be presented to the JavaScript function you name:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
init = function(params) {&lt;br /&gt;
    // Use the arguments through params.key1 and params.key2.&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== A basic module ===&lt;br /&gt;
&lt;br /&gt;
The most common use-case for JavaScript in Moodle is to utilise existing&lt;br /&gt;
modules to do something. Your module isn&#039;t intended to be reused, or&lt;br /&gt;
extended by some other piece of code. In these cases, you want to keep&lt;br /&gt;
things simple.&lt;br /&gt;
&lt;br /&gt;
This section will build up the YUI module gradually, but you can cheat and skip to the [[#Additional_functions_instead_of_anonymous_functions|completed example]].&lt;br /&gt;
&lt;br /&gt;
==== Namespacing ====&lt;br /&gt;
&lt;br /&gt;
One of the great benefits of using YUI is the ability to sandbox code in&lt;br /&gt;
such a way that you can be sure that it won&#039;t interfere with other JS code&lt;br /&gt;
in Moodle, this is done by placing your object in a JavaScript object.&lt;br /&gt;
Using our fictitious example, this namespace is very similar to the module&lt;br /&gt;
name namespace:&lt;br /&gt;
&lt;br /&gt;
  M.FRANKENSTYLE.MODNAME&lt;br /&gt;
&lt;br /&gt;
As a JavaScript object this would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
M: {&lt;br /&gt;
  FRANKENSTYLE: {&lt;br /&gt;
    MODNAME: {&lt;br /&gt;
      // Your code and functions go here.&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The easiest way of creating this structure is by using the logical OR operator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
M.block_fruit = M.block_fruit || {};&lt;br /&gt;
M.block_fruit.fruitbowl = {};&lt;br /&gt;
var NS = M.block_fruit.fruitbowl;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This ensures that any existing code on the M.block_fruit object is not&lt;br /&gt;
inadvertently overwritten, but also ensures that the definition for the&lt;br /&gt;
fruitbowl code is clean.&lt;br /&gt;
&lt;br /&gt;
That&#039;s to say that, if you have already used your fruitbowl code once on&lt;br /&gt;
the page, and have modified it in some way (for example to override a&lt;br /&gt;
function), then the next time it is used, it will be in it&#039;s original state&lt;br /&gt;
with the original function.&lt;br /&gt;
&lt;br /&gt;
==== Initialisation ====&lt;br /&gt;
&lt;br /&gt;
Once you have your namespace, you&#039;ll want to create one or more functions on this namespace in which to put your code. Typically, we use an &#039;init&#039; function to perform the initial setup.&lt;br /&gt;
The amount that this code does should be kept to a minimum because every&lt;br /&gt;
piece of JavaScript which has to be executed at page load is a piece of&lt;br /&gt;
code slowing the page down. As a best practice:&lt;br /&gt;
* don&#039;t modify the DOM unless you need to do so;&lt;br /&gt;
* don&#039;t create anything you aren&#039;t using immediately (for example a JS dialogue hidden until first used); and&lt;br /&gt;
* use event delegation where possible.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
M.block_fruit = M.block_fruit || {};&lt;br /&gt;
var NS = M.block_fruit.fruitbowl = {};&lt;br /&gt;
&lt;br /&gt;
NS.init = function() {&lt;br /&gt;
    Y.delegate(&#039;click&#039;, function(e) {&lt;br /&gt;
        // Alert users when they&#039;ve clicked on some fruit to tell them the obvious.&lt;br /&gt;
        alert(&amp;quot;You clicked on some fruit&amp;quot;);&lt;br /&gt;
        &lt;br /&gt;
        // Add a border to the fruit so we can see that it was selected.&lt;br /&gt;
        e.setStyle(&#039;border&#039;, &#039;1px solid black&#039;);&lt;br /&gt;
    }, Y.config.doc, &#039;.fruit&#039;);&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Separation of code from configuration and style (loose coupling) ====&lt;br /&gt;
&lt;br /&gt;
As another best practice, we encourage you to separate out the code from&lt;br /&gt;
configuration, and not to apply any CSS styles directly. Instead, use&lt;br /&gt;
techniques to move the configuration out of the code itself and into&lt;br /&gt;
variables or attributes, and use CSS classes which the theme can modify.&lt;br /&gt;
&lt;br /&gt;
Typically to make it easier to read your code, and to modify it later, we&lt;br /&gt;
recommend creating two static objects at the top of your code: one for CSS&lt;br /&gt;
selectors, and one for CSS class names.&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
var CSS = {&lt;br /&gt;
        FRUIT: &#039;fruit&#039;,&lt;br /&gt;
        SELECTED: &#039;selected&#039;&lt;br /&gt;
    },&lt;br /&gt;
    SELECTORS = {&lt;br /&gt;
        FRUIT: &#039;.&#039; + CSS.FRUIT&lt;br /&gt;
    },&lt;br /&gt;
    NS;&lt;br /&gt;
&lt;br /&gt;
M.block_fruit = M.block_fruit || {};&lt;br /&gt;
NS = M.block_fruit.fruitbowl = {};&lt;br /&gt;
&lt;br /&gt;
NS.init = function() {&lt;br /&gt;
    Y.delegate(&#039;click&#039;, function() {&lt;br /&gt;
        // Alert users when they&#039;ve clicked on some fruit to tell them the obvious.&lt;br /&gt;
        alert(&amp;quot;You clicked on some fruit&amp;quot;);&lt;br /&gt;
        &lt;br /&gt;
        // Apply the relevant class which contains indications that this fruit was selected.&lt;br /&gt;
        e.target.addClass(CSS.SELECTED);&lt;br /&gt;
    }, Y.config.doc, SELECTORS.FRUIT, this);&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this change, if at a later date you need to change the styling on a&lt;br /&gt;
selected fruit, this can be done in the theme. An alternative theme can&lt;br /&gt;
also choose to theme the same item in a completely different way.&lt;br /&gt;
&lt;br /&gt;
It also means that if you need to change the class names, you can do so&lt;br /&gt;
once in the JavaScript without making it difficult to work out the purpose&lt;br /&gt;
of a particular line of code from git.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Additional functions instead of anonymous functions ====&lt;br /&gt;
&lt;br /&gt;
Although it&#039;s often quicker to write an inline anonymous function when&lt;br /&gt;
you write your event handlers, loops, and at other times, it&#039;s often much&lt;br /&gt;
easier to read the code if you move it to a function on your namespace and&lt;br /&gt;
call it accordingly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code javascript&amp;gt;&lt;br /&gt;
var CSS = {&lt;br /&gt;
        FRUIT: &#039;fruit&#039;,&lt;br /&gt;
        SELECTED: &#039;selected&#039;&lt;br /&gt;
    },&lt;br /&gt;
    SELECTORS = {&lt;br /&gt;
        FRUIT: &#039;.&#039; + CSS.FRUIT&lt;br /&gt;
    },&lt;br /&gt;
    NS;&lt;br /&gt;
&lt;br /&gt;
M.block_fruit = M.block_fruit || {};&lt;br /&gt;
NS = M.block_fruit.fruitbowl = {};&lt;br /&gt;
&lt;br /&gt;
NS.init = function() {&lt;br /&gt;
    Y.delegate(&#039;click&#039;, this.handle_selection, Y.config.doc, SELECTORS.FRUIT, this);&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
NS.handle_selection = function(e) {&lt;br /&gt;
    // Alert users when they&#039;ve clicked on some fruit to tell them the obvious.&lt;br /&gt;
    alert(&amp;quot;You clicked on some fruit&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // Apply the relevant class which contains indications that this fruit was selected.&lt;br /&gt;
    e.target.addClass(CSS.SELECTED);&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can clearly see your what your initialiser does, and you can call handle_selection for other events too without duplicating code.&lt;br /&gt;
&lt;br /&gt;
=== A re-usable module ===&lt;br /&gt;
&lt;br /&gt;
{{Work in progress}} This section of documentation has yet to be written.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
&lt;br /&gt;
There is a proposal to [[YUI/Namespacing|alter the namespace]] for YUI modules. This is likely to be implemented from Moodle 2.6&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=39075</id>
		<title>Themes overview</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=39075"/>
		<updated>2013-04-17T15:52:34Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* The different layouts as of 17th August 2010 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}{{Moodle 2.0}}Welcome to the new world of themes in Moodle 2.0!&lt;br /&gt;
&lt;br /&gt;
A Moodle theme allows the user to change the look and feel of a Moodle site.  Themes can be applied on the site, category, course and activity levels by users with permissions to do so.  Themes can be designed for specific devices such as mobile phones or tablets. This page explains how themes work in Moodle and is intended to help you create or modify most themes for Moodle 2.0&lt;br /&gt;
&lt;br /&gt;
You can use contributed themes or create your entire own to share with the community. Themes can also be based on parent themes with only few customizations. Themes accomplish this using CSS, changing the underlying markup structure and also adding Javascript to add more advanced behaviors.&lt;br /&gt;
&lt;br /&gt;
Most theme developers simply add a few changes to their new theme by basing it on an existing one. The Moodle Theme architecture is designed in such a way whereby the base theme will act as a fall-back that is used when nothing has been defined in the theme based on it. This makes it easy to create new themes that simply seek out to make minor changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.4==&lt;br /&gt;
{{Moodle 2.4}}&lt;br /&gt;
&lt;br /&gt;
===HTML 5 doctype===&lt;br /&gt;
&lt;br /&gt;
By default Moodle is sending HTML5 doctype. Themes designers may decide to force old xhtml strict mode, but it is strongly discouraged and the site will not pass strictness validation. (MDL-34299)&lt;br /&gt;
&lt;br /&gt;
===Internet Explorer standards mode===&lt;br /&gt;
&lt;br /&gt;
Since 2.4 Moodle automatically sends X-UA-Compatible edge header, this should prevent Internet Explorer from switching to quirks or compatibility modes (MDL-36524). There is also a new workaround for intranet servers which previously identified recent IE browsers as IE7. (MDL-36481)&lt;br /&gt;
&lt;br /&gt;
===SVG icons===&lt;br /&gt;
&lt;br /&gt;
Most modern browsers support SVG icons. The benefit is that SVG scales perfectly to any screen resolution or zoom. It is now possible to add icons in SVG format to pix directories, Moodle uses SVG in supported browsers and PNG in legacy browsers. (MDL-22955)&lt;br /&gt;
&lt;br /&gt;
Please note that IE9 does not handle scaling of standard SVG icons properly, you may have to manually execute a special script from theme/base/cli/svgtool.php to alter the icons to be compatible with buggy IE9. (MDL-36436)&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.0==&lt;br /&gt;
&lt;br /&gt;
The theme system was completely redesigned in Moodle 2.0.  Known issues have been addressed and new features have been added to meet community requests.&lt;br /&gt;
&lt;br /&gt;
Unfortunately it was not possible to maintain backward compatibility, so all Moodle 1.x themes need to be recreated for Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
Major changes include:&lt;br /&gt;
* Clearer and more consistent CSS classes and IDs throughout all pages in Moodle&lt;br /&gt;
* Introduction of layout files (templates) describing overall layout HTML for many different types of pages in Moodle.&lt;br /&gt;
* Introduction of renderers, which produce the smaller &amp;quot;parts&amp;quot; of a HTML page.  Advanced themes can choose to override these too if they choose.&lt;br /&gt;
* Introduction of standard methods for adding Javascript to themes.&lt;br /&gt;
* Easier control over icons and images in Moodle.&lt;br /&gt;
* The old &amp;quot;standard&amp;quot; theme has been split into two themes:&lt;br /&gt;
**&#039;&#039;&#039;base&#039;&#039;&#039; - contains absolutely basic layout, and&lt;br /&gt;
**&#039;&#039;&#039;standard&#039;&#039;&#039; - which adds CSS to the base theme to make it look like the old standard theme.&lt;br /&gt;
* Performance tuning: In normal production mode CSS files are combined into a single optimised file, and both CSS and JavaScript files are minimised to ensure there are no wasted connections or traffic.  Files are heavily cached, but also versioned, so that users never need to clear their caches.&lt;br /&gt;
&lt;br /&gt;
==The structure of a theme==&lt;br /&gt;
&lt;br /&gt;
Some important things to know when building good themes:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;config.php&#039;&#039;&#039; - this file is required in every theme.  It defines configuration settings and definitions required to make the theme work in Moodle. These include theme, file, region, default region and options. &lt;br /&gt;
# &#039;&#039;&#039;Layouts and layout files&#039;&#039;&#039; -  in config.php there is one definition for each page type (see [[#theme_layouts_table|Appendix A: Theme layouts]] for a list of over 12 types).  Each page type definition tells Moodle which layout file will be used, what block regions this page type should display and so on.  The layout file contains the HTML and the minimum PHP required to display basic structure of pages. (If you know Moodle 1.9, it&#039;s like a combination of header.html and footer.html).&lt;br /&gt;
# &#039;&#039;&#039;The base theme&#039;&#039;&#039; - is not intended to be used for production sites.  It sets up the simplest possible generic layout and includes only CSS essential to that layout &#039;&#039;or&#039;&#039; to Moodle as a whole.  It tries not to make any unnecessary rules and makes as few assumptions as possible.  It&#039;s the perfect base on which to start designing a theme, as there are very few colours, borders, margins, and alignments to override.  You can just start adding what you need.&lt;br /&gt;
&lt;br /&gt;
===Files and folders===&lt;br /&gt;
A theme&#039;s files are placed in a folder with under moodle/theme folder and have subfolders. They are laid out like this:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Directory&lt;br /&gt;
! File&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| /config.php&lt;br /&gt;
| Contains all of the configuration and definitions for each theme&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| /lib.php &lt;br /&gt;
| Contains speciality classes and functions that are used by theme&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| /renderers.php &lt;br /&gt;
| Contains any custom renderers for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| /settings.php &lt;br /&gt;
| Contains custom theme settings. These local settings are defined by the theme allowing the theme user to easily alter something about the way it looks or operates. (eg a background colour, or a header image)&lt;br /&gt;
|-&lt;br /&gt;
| /javascript/ &lt;br /&gt;
| &lt;br /&gt;
| All specialty JavaScript files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /lang/ &lt;br /&gt;
| &lt;br /&gt;
| Any special language files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /layout/ &lt;br /&gt;
| &lt;br /&gt;
| Contains the layout files for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/ &lt;br /&gt;
| &lt;br /&gt;
| Contains any images the theme makes use of either in CSS or in the layout files.&lt;br /&gt;
|-&lt;br /&gt;
|  /pix&lt;br /&gt;
| /favicon.ico &lt;br /&gt;
| The favicon to display for this theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix&lt;br /&gt;
| /screenshot.jpg &lt;br /&gt;
| A screenshot of the theme to be displayed in on the theme selection screen.&lt;br /&gt;
|-&lt;br /&gt;
| /style &lt;br /&gt;
| &lt;br /&gt;
| Default location for CSS files.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|/*.css&lt;br /&gt;
|CSS files the theme requires&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are also several other places that stylesheets can be included from (see the CSS how and why section below).&lt;br /&gt;
&lt;br /&gt;
==Theme options==&lt;br /&gt;
All theme options are set within the config.php file for the theme.  The settings that are most used are: parents, sheets, layouts, and javascripts. Have a look at the &#039;&#039;&#039;[[#theme_options_table|theme options table]]&#039;&#039;&#039; for a complete list of theme options which include lesser used specialised or advanced settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Basic theme config example===&lt;br /&gt;
Lets have a look at a basic theme configuration file and the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;newtheme&#039;;&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;parents = array(&lt;br /&gt;
    &#039;base&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;admin&#039;,&lt;br /&gt;
    &#039;blocks&#039;,&lt;br /&gt;
    &#039;calendar&#039;,&lt;br /&gt;
    &#039;course&#039;,&lt;br /&gt;
    &#039;grade&#039;,&lt;br /&gt;
    &#039;message&#039;,&lt;br /&gt;
    &#039;question&#039;,&lt;br /&gt;
    &#039;user&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    )&lt;br /&gt;
    //.......&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;javascripts_footer = array(&lt;br /&gt;
    &#039;navigation&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic theme example settings explained===&lt;br /&gt;
First up you will notice everything is added to $THEME. This is the theme&#039;s configuration object, it is created by Moodle using default settings and is then updated by whatever settings you add to it.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;name : The first setting, is the theme&#039;s name. This should simply be whatever your theme&#039;s name is, most likely whatever you named your theme directory.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;parents : This defines the themes that the theme will extend. In this case it is extending only the base theme.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;sheets : An array containing the names of the CSS stylesheets to include for this theme. Note that it is just the name of the stylesheet and does not contain the directory or the file extension. Moodle assumes that the theme&#039;s stylesheets will be located in the styles directory of the theme and have .css as an extension.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;layouts : In this example, two layouts have been defined to override the layouts from the base theme. For more information see the [[#Layouts|layouts]] section below.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;javascripts_footer : The final setting is to include a JavaScript file. Much like stylesheets, you only need to provide the files name. Moodle will assume it is in your themes JavaScript directory and be a .js file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: When you first begin writing themes, make sure you take a look at the configuration files of the other themes that get shipped with Moodle. You will get a good picture of how everything works, and what is going on in a theme, simply by reading it and taking notice of what it is including or excluding.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
===Locations of CSS files===&lt;br /&gt;
First lets look at where CSS can be included from within Moodle:&lt;br /&gt;
; \theme\themename\style\*.css : This is the default location for all of the stylesheets that are used by a theme and the place which should be used by a theme designer.&lt;br /&gt;
&lt;br /&gt;
New theme developers should note that the order in which CSS files are found and included creates a hierarchy.  This order ensures that the rules, within a theme&#039;s style sheets, take precedence over identical rules in other files that may have been introduced before.  This can both extend another files definitions (see parent array in the config file) and also ensures that the current theme&#039;s CSS rules/definitions have the last say.&lt;br /&gt;
&lt;br /&gt;
There are other locations that can be used (although very rarely) to include CSS in a page. A developer of a php file can manually specify a stylesheet from anywhere within Moodle, like the database. Usually, if code is doing this, it is because there is a non-theme config or plugin setting that contains information requires special CSS information.  As a theme designer you should be aware of, but not have to worry about, these locations of CSS files.  Here are some examples:&lt;br /&gt;
&lt;br /&gt;
; {pluginpath}\styles.css e.g. \block\blockname\styles.css or \mod\modname\styles.css : Every plugin can have its own styles.css file. This file should only contain the required CSS rules for the module and should not add anything to the look of the plugin such as colours, font sizes, or margins other than those that are truly required.&amp;lt;br /&amp;gt;Theme specific styles for a plugin should be located within the themes styles directory.&lt;br /&gt;
; {pluginpath}\styles_themename.css : This should only ever be used by plugin developers. It allows them to write CSS that is designed for a specific theme without having to make changes to that theme. You will notice that this is never used within Moodle and is designed to be used only by contributed code.&lt;br /&gt;
&lt;br /&gt;
As theme designers, we will only use the first method of introducing CSS: adding rules to a stylesheet file located in the theme&#039;s style directory.&lt;br /&gt;
&lt;br /&gt;
===Moodle&#039;s core CSS organisation===&lt;br /&gt;
The next thing to look at is the organisation of CSS and rules within a theme. Although as a theme designer it is entirely up to you as to how you create and organise your CSS. Please note that within the themes provided in the standard install by Moodle there is a very clear organisation of CSS.&lt;br /&gt;
&lt;br /&gt;
First is the  pagelayout.css file. This contains the CSS required to give the layouts their look and feel.  It doesn&#039;t contain any rules that affect the content generated by Moodle.&lt;br /&gt;
&lt;br /&gt;
Next is the core.css file. If you open up core you will notice that it contains all manner of general (usually simple) rules that don&#039;t relate to a specific section of Moodle but to Moodle as a whole.&lt;br /&gt;
&lt;br /&gt;
There can also be rules that relate to specific sections.  However, this is done only when there are only a handful of rules for that section. These small clusters of rules are grouped together and separated by comments identifying for which section each relates.&lt;br /&gt;
&lt;br /&gt;
Finally there are all the other CSS files, you will notice that there is a file for each section of Moodle that has a significant collection of rules.&lt;br /&gt;
&lt;br /&gt;
:For those who are familiar with Moodle 1.9 theme&#039;s, this organisation will be a big change. In 1.9, CSS was organised by its nature (for example: colours, layout, other).&lt;br /&gt;
&lt;br /&gt;
===How to write effective CSS rules within Moodle===&lt;br /&gt;
In Moodle 2.0, writing good CSS rules is incredibly important.&lt;br /&gt;
&lt;br /&gt;
Due to performance requirements and browser limitations, all of the CSS files are combined into a single CSS file that gets included every time. This means that rules need to be written in such a way as to minimise the chances of a collision leading to unwanted styles being applied. Whilst writing good CSS is something most designers strive for we have implemented several new body classes and prompt developers to use appropriate classnames.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;body&amp;gt; CSS id and classes ====&lt;br /&gt;
As of Moodle 2.0 the ID tag that gets applied to the body will always be a representation of the URI. For example if you are looking at a forum posting and the URI is &#039;/mod/forum/view.php&#039; then the body tags ID will be &#039;#page-mod-forum-view&#039;.&lt;br /&gt;
&lt;br /&gt;
As well as the body&#039;s ID attribute the URI is also exploded to form several CSS classes that get added to the body tag, so in the above example &#039;/mod/forum/view&#039; you would end up with the following classes being added to the body tag &#039;.path-mod&#039;, &#039;.path-mod-forum&#039;. Note that &#039;.path-mod-forum-view&#039; is not added as a class, this is intentionally left out to lessen confusion and duplication as rules can relate directly to the page by using the ID and do not require the final class.&lt;br /&gt;
&lt;br /&gt;
The body ID and body classes described above will form the bread and butter for many of the CSS rules you will need to write for your theme, however there are also several other very handy classes that get added to the body tag that will be beneficial to you once you start your journey down the rabbit hole that is themeing. Some of the more interesting classes are listed below.&lt;br /&gt;
&lt;br /&gt;
* If JavaScript is enabled then &#039;jsenabled&#039; will be added as a class to the body tag allowing you to style based on JavaScript being enabled or not.&lt;br /&gt;
* Either &#039;dir-rtl&#039; or &#039;dir-ltr&#039; will be added to the body as a class depending on the direction of the language pack: rtl = right to left, ltr = left to right. This allows you to determine your text-alignment based on language if required.&lt;br /&gt;
* A class will be added to represent the language pack currently in use, by default en_utf8 is used by Moodle and will result in the class &#039;lang-en_utf8&#039; being added to the body tag.&lt;br /&gt;
* The wwwroot for Moodle will also be converted to a class and added to the body tag allowing you to stylise your theme based on the URL through which it was reached. e.g. http://sam.moodle.local/moodle/ will become &#039;.sam-moodle-local—moodle&#039;&lt;br /&gt;
* If the current user is not logged then &#039;.notloggedin&#039; will be added to the body tag.&lt;br /&gt;
&lt;br /&gt;
What does all of this look like in practise? Well using the above example /mod/forum/view.php you would get at least the following body tag:&lt;br /&gt;
&amp;lt;code html4strict&amp;gt;&amp;lt;body id=”page-mod-forum-view” class=”path-mod path-mod-forum” /&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Writing your rules====&lt;br /&gt;
&lt;br /&gt;
By following the [[CSS coding style]] and CSS best-practices and understanding the [http://htmlhelp.com/reference/css/structure.html#cascade cascading order] of CSS a theme developer will reduce collisions and lines of CSS that is written. CSS classes have been placed where it is believed anyone may want to apply their own styles.&lt;br /&gt;
&lt;br /&gt;
When starting to write rules make sure that you have a good understanding of where you want those rules to be applied, it is a good idea to make the most of the body classes mentioned above.&lt;br /&gt;
If you want to write a rule for a specific page make use of the body tag&#039;s ID, e.g.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;#page-mod-forum-view .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to write a rule that will be applied all throughout the forum.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;.path-mod-forum .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The other very important thing to take into consideration is the structure leading up to the tag you want to style. Browsers apply conflicting styles with priority on the more specific selectors. It can be very beneficial to keep this in mind and write full selectors that rely on the structure of the tags leading to the tag you wish to style.&lt;br /&gt;
&lt;br /&gt;
By making use of body id&#039;s and classes and writing selectors to take into account the leading structure you can greatly minimise the chance of a collision both with Moodle now and in the future.&lt;br /&gt;
&lt;br /&gt;
==Layouts==&lt;br /&gt;
Layouts are defined in &#039;&#039;&#039;config.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
All themes are required to define the layouts they wish to be responsible for as well as create; however, many layout files are required by those layouts. If the theme is overriding another theme then it is a case of deciding which layouts this new theme should override. If the theme is a completely fresh start then you will need to define a layout for each of the different possibilities. &lt;br /&gt;
&lt;br /&gt;
It is also important to note that a new theme that will base itself on another theme (overriding it) does not need to define any layouts or use any layout files if there are no changes that it wishes to make to the layouts of the existing theme. The standard theme in Moodle is a good example of this as it extends the base theme simply adding CSS to achieve its look and feel.&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, layouts are defined in config.php within $THEME-&amp;gt;layouts. The following is an example of one such layout definition:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    // Standard layout with blocks, this is recommended for most pages with general information&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;base&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;&lt;br /&gt;
    )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The first thing Moodle looks at is the name of the layout, in this case it is `standard` (the array key in PHP), it then looks at the settings for the layout, this is the theme, file, regions, and default region. There are also a couple of other options that can be set by a layout.&lt;br /&gt;
&lt;br /&gt;
; theme : is the theme the layout file exists in. That&#039;s right: you can make use of layouts from other installed themes. &#039;&#039;Optional&#039;&#039;&lt;br /&gt;
; file : is the name of the layout file this layout wants to use. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; regions : is the different block regions (places you can put blocks) within the theme. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; defaultregion : is the default location when adding new blocks. &#039;&#039;&#039;Required if regions is non-empty, otherwise optional&#039;&#039;&#039;&lt;br /&gt;
; options : an array of layout specific options described in detail below. &#039;&#039;&#039;Optional&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;theme&#039;&#039;&#039; is optional. Normally the the layout file is looked for in the current theme, or, if it is not there, in the parent theme. However, you can use a layout file from any other theme by giving the theme name here.&lt;br /&gt;
&lt;br /&gt;
You can define whatever regions you like. You just need to pick a name for each one. Most themes just use one or both of &#039;&#039;&#039;side_pre&#039;&#039;&#039; and &#039;&#039;&#039;side_post&#039;&#039;&#039;, which is like &#039;left side&#039; and &#039;right side&#039;, except in right to left languages, when they are reversed. If you say in config.php that your the layout provides regions called &#039;fred&#039; and &#039;barney&#039;, then you must call $OUTPUT-&amp;gt;blocks_for_region(&#039;fred&#039;) and $OUTPUT-&amp;gt;blocks_for_region(&#039;barney&#039;) somewhere in the layout file.&lt;br /&gt;
&lt;br /&gt;
The final setting &#039;&#039;&#039;options&#039;&#039;&#039; is a special case that only needs to be set if you want to make use of it. This setting allows the theme designer to specify special options that they would like to create that can be later accessed within the layout file. This allows the theme to make design decisions during the definition and react upon those decisions in what ever layout file is being used.&lt;br /&gt;
&lt;br /&gt;
One such place this has been used is within the base theme. If you take a look first at theme/base/config.php you will notice that several layouts specify options &#039;&#039;&#039;nonavbar&#039;&#039;&#039; and &#039;&#039;&#039;nofooter&#039;&#039;&#039; which can both be set to either true or false. Then if we take a look at theme/base/layout/general.php you will spot lines like the following:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hasnavbar = (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar());&lt;br /&gt;
$hasfooter = (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;]));&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
............&lt;br /&gt;
&amp;lt;?php if ($hasnavbar) { ?&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
What you are seeing here is the use of those settings from the layout within the layout file. In this case it is being used to toggle the display of the navigation bar and page footer.&lt;br /&gt;
&lt;br /&gt;
==Layout files==&lt;br /&gt;
A layout file is a file that contains the core HTML structure for a layout including the header, footer, content and block regions. For those of you who are familiar with themes in Moodle 1.9 this is simply header.html and footer.html combined. Of course it is not all HTML, there are bits of HTML and content that Moodle needs to put into the page, within each layout file this will be done by a couple of simple PHP calls to get bits and pieces including content.&lt;br /&gt;
&lt;br /&gt;
Before learning more it is good to understand the two primary objects that will be used in your layout files: $OUTPUT and $PAGE.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$OUTPUT&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;core_renderer&amp;lt;/code&amp;gt; class which is defined in lib/outputrenderers.php. Each method is clearly documented there, along with which is appropriate for use within the layout files.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$PAGE&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;moodle_page&amp;lt;/code&amp;gt; class defined in lib/pagelib.php. Most of the things you will want to use are the properties that are all documented at the top of the file. If you are not familiar with PHP properties, you access them like $PAGE-&amp;gt;activityname, just like fields of an ordinary PHP object. (However, behind the scenes the value you get is produced by calling a function. Also, you cannot change these values, they are &#039;&#039;&#039;read-only&#039;&#039;&#039;. However, you don&#039;t need to understand all that if you are just using these properties in your theme.)&lt;br /&gt;
&lt;br /&gt;
The following is a very simple layout file to illustrate the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid) ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses) ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;table id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
            &amp;lt;?php&lt;br /&gt;
            echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
            ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We assume you know enough HTML to understand the basic structure above, but let&#039;s explain the PHP code since that is less obvious.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This occurs at the VERY top of the page, it must be the first bit of output and is responsible for adding the (X)HTML document type definition to the page. This of course is determined by the settings of the site and is one of the things that the theme designer has no control over.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we have started writing the opening html tag and have asked Moodle to give us the HTML attributes that should be applied to it. This again is determined by several settings within the actual HTML install.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This gets us the title for the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This very important call gets us the standard head HTML that needs to be within the HEAD tag of the page. This is where CSS and JavaScript requirements for the top of the page will be output as well as any special script or style tags.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid); ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses); ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Much like the html tag above we have started writing the body tag and have asked for Moodle to get us the desired ID and classes that should be applied to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading; ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are creating the header for the page. In this case we want the heading for the page, we want to display the login information which will be the current users username or a link to log in if they are not logged in, and we want the heading menu if there is one.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-pre&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is one of the most important calls within the file, it determines where the actual content for the page gets inserted.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-post&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This final bit of code gets the content for the footer of the page. It gets the login information which is the same as in the header, a home link, and the standard footer HTML which like the standard head HTML contains all of the script and style tags required by the page and requested to go in the footer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: Within Moodle 2.0 most of the JavaScript for the page will be included in the footer. This greatly helps reduce the loading time of the page.&lt;br /&gt;
&lt;br /&gt;
When writing layout files think about the different layouts and how the HTML that each makes use of will differ. You will most likely find you do not need a different layout file for each layout, most likely you will be able to reuse the layout files you create across several layouts. You can of course make use of layout options as well to further reduce the number of layout files you need to produce.&lt;br /&gt;
&lt;br /&gt;
Of course as mentioned above if you are customising an existing theme then you may not need to create any layouts or layout files at all.&lt;br /&gt;
&lt;br /&gt;
==Language File==&lt;br /&gt;
&lt;br /&gt;
You need to create a language file for your theme with a few standard strings in it. At a minimum create a file called lang/en/theme_themename.php in your theme folder. For example, the &#039;standard&#039; theme has a language file called lang/en/theme_standard.php. &lt;br /&gt;
&lt;br /&gt;
You &#039;&#039;&#039;must&#039;&#039;&#039; define the following lines in your file (example is from standard theme, adapt as required):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Standard&#039;;&lt;br /&gt;
$string[&#039;region-side-post&#039;] = &#039;Right&#039;;&lt;br /&gt;
$string[&#039;region-side-pre&#039;] = &#039;Left&#039;;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;This theme is a very basic white theme, with a minimum amount of &lt;br /&gt;
 CSS added to the base theme to make it actually usable.&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without the above you will get notices for the missing strings.&lt;br /&gt;
&lt;br /&gt;
==Making use of images==&lt;br /&gt;
Right at the start when listing the features of the new themes system one of the features mentioned was the ability to override any of the standard images within Moodle from within your theme. At this point we will look at both how to make use of your own images within your theme, and secondly how to override the images being used by Moodle.&lt;br /&gt;
So first up a bit about images within Moodle,&lt;br /&gt;
&lt;br /&gt;
# Images you want to use within your theme &#039;&#039;&#039;need&#039;&#039;&#039; to be located within your theme&#039;s pix directory.&lt;br /&gt;
# You can use sub directories within the pix directory of your theme.&lt;br /&gt;
# Images used by Moodle&#039;s core are located within the pix directory of Moodle.&lt;br /&gt;
# Modules, blocks and other plugins should also store their images within a pix directory.&lt;br /&gt;
&lt;br /&gt;
So making use of your own images first up. Lets assume you have added two image files to the pix directory of your theme.&lt;br /&gt;
&lt;br /&gt;
* /theme/yourthemename/pix/imageone.jpg&lt;br /&gt;
* /theme/yourthemename/pix/subdir/imagetwo.png&lt;br /&gt;
&lt;br /&gt;
Notice that one image is a JPEG image, and the second is a PNG. Also the second image is in a subdirectory.&lt;br /&gt;
&lt;br /&gt;
The following code snippet illustrates how to make use of your images within HTML, such as if you wanted to use them within a layout file.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;imageone&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;subdir/imagetwo&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT&#039;&#039;&#039; include the image file extension. Moodle will work it out automatically and it will not work if you do include it.&lt;br /&gt;
&lt;br /&gt;
In this case rather than writing out the URL to the image we use a method of Moodle&#039;s output library. Its not too important how that functions works but it is important that we use it as it is what allows images within Moodle to be over-rideable.&lt;br /&gt;
&lt;br /&gt;
The following is how you would use the images from within CSS as background images.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.divone {&lt;br /&gt;
    background-image: url([[pix:theme|imageone]]);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.divtwo {&lt;br /&gt;
    background-image: url([[pix:theme|subdir/imagetwo]]);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If this case we have to use some special notations that Moodle looks for. Whenever Moodle hands out a CSS file it first searches for all &#039;&#039;[[something]]&#039;&#039; tags and replaces them with what is required.&lt;br /&gt;
&lt;br /&gt;
The final thing to notice with both of the cases above is that at no point do we include the images file extension. &lt;br /&gt;
The reason for this leads us into the next topic, how to override images.&lt;br /&gt;
&lt;br /&gt;
From within a theme you can VERY easily override any standard image within Moodle by simply adding the replacement image to the theme&#039;s pix directory in the same sub directory structure as it is in Moodle.&lt;br /&gt;
So for instance we wanted to override the following two images:&lt;br /&gt;
# /pix/moodlelogo.gif&lt;br /&gt;
# /pix/i/user.gif&lt;br /&gt;
We would simply need to add our replacement images to the theme in the following locations&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.gif&lt;br /&gt;
# /theme/themename/pix_core/i/user.gif&lt;br /&gt;
&#039;&#039;Note that we have created a &#039;&#039;&#039;pix_core&#039;&#039;&#039; directory in our theme. For module images we need a &#039;&#039;&#039;pix_mod&#039;&#039;&#039; directory. See [[Themes_2.0_How_to_use_images_within_your_theme|using images within your theme]] for the full story.&lt;br /&gt;
&lt;br /&gt;
Now the other very cool thing to mention is that Moodle looks for not just replacements of the same image type (jpg, gif, etc...) but also replacements in any image format. This is why above when working with our images we never specified the images file extension.&lt;br /&gt;
This means that the following would also work:&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.png&lt;br /&gt;
# /theme/themename/pix_core/i/user.bmp&lt;br /&gt;
&lt;br /&gt;
For a more detailed description of how this all works see the page on [[Themes_2.0_How_to_use_images_within_your_theme|using images within your theme]]&lt;br /&gt;
&lt;br /&gt;
==Unobvious Things==&lt;br /&gt;
===Getting Your Theme to Appear Correctly in Theme Selector===&lt;br /&gt;
If you follow the examples on this page to the letter, when you go to the Theme Selector page you may be discouraged to find that your theme does not appear like the other themes do. In fact, instead of your theme&#039;s name, you will see something along the lines of &amp;lt;nowiki&amp;gt;[[pluginname]]&amp;lt;/nowiki&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
To correct this, you must add the theme/THEMENAME/lang/en/theme_THEMENAME.php file, where THEMENAME is the name of the theme folder. Inside that file, add the string &amp;quot;$string[&#039;pluginname&#039;] = &#039;THEMENAME&#039;; &amp;quot;. Make THEMENAME the name of your theme, however you want it displayed in the Theme selector.&lt;br /&gt;
&lt;br /&gt;
Also, make sure to change your config.php file and version.php file to reflect the correct name:&lt;br /&gt;
&lt;br /&gt;
In config.php: $THEME-&amp;gt;name = &#039;NAME&#039;;&lt;br /&gt;
&lt;br /&gt;
In version.php: $plugin-&amp;gt;component = &#039;theme_NAME&#039;; // Full name of the plugin (used for diagnostics)&lt;br /&gt;
&lt;br /&gt;
The screenshot for the theme should be about 500x400 px.&lt;br /&gt;
&lt;br /&gt;
===Required theme divs===&lt;br /&gt;
&lt;br /&gt;
Some parts of Moodle may rely on particular divs, for example the div with id &#039;page-header&#039;.&lt;br /&gt;
&lt;br /&gt;
Consequently all themes must include at least the divs (with the same ids) that are present in the &#039;base&#039; theme. &lt;br /&gt;
&lt;br /&gt;
Missing out these elements may result in unexpected behaviour within specific modules or other plugins.&lt;br /&gt;
&lt;br /&gt;
==Appendix A==&lt;br /&gt;
===Theme options as of 17th April 2013===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_options_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting&lt;br /&gt;
! Effect&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;csspostprocess&#039;&#039;&#039;&lt;br /&gt;
|  Allows the user to provide the name of a function that all CSS should be passed to before being delivered.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;editor_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include within the body of the editor.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;enable_dock&#039;&#039;&#039;&lt;br /&gt;
|  If set to true the side dock is enabled for blocks&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;hidefromselector&#039;&#039;&#039;&lt;br /&gt;
| Used to hide a theme from the theme selector (unless theme designer mode is on). Accepts true or false.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;filter_mediaplugin_colors&#039;&#039;&#039;&lt;br /&gt;
|  Used to control the colours used in the small media player for the filters&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array containing the names of JavaScript files located in /javascript/ to include in the theme. (gets included in the head)&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts_footer&#039;&#039;&#039;&lt;br /&gt;
|  As above but will be included in the page footer.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;larrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the left arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;layouts&#039;&#039;&#039;&lt;br /&gt;
|  An array setting the layouts for the theme&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;name&#039;&#039;&#039;&lt;br /&gt;
| Name of the theme. Most likely the name of the directory in which this file resides.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents&#039;&#039;&#039;&lt;br /&gt;
|  An array of themes to inherit from&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array of JavaScript files NOT to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets not to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;plugins_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of plugin sheets to ignore and not include.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;rarrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the right arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;renderfactory&#039;&#039;&#039;&lt;br /&gt;
|  Sets a custom render factory to use with the theme, used when working with custom renderers.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;resource_mp3player_colors&#039;&#039;&#039;&lt;br /&gt;
|  Controls the colours for the MP3 player&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include for this theme. Should be located in the theme&#039;s style directory.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;supportscssoptimisation&#039;&#039;&#039;&lt;br /&gt;
|  When set to &#039;FALSE&#039; then the theme will not be affected by the &#039;CSS Optimiser&#039;.  The &#039;CSS Optimiser&#039; is enabled in Development &amp;gt; Experimental &amp;gt; Experimental settings.  When it is enabled CSS will be run through an optimisation process before being cached. The optimiser processes the CSS removing duplicate rules and styles, as well as white space removable and reformatting. Please note turning this on at the same time as theme designer mode is awful for performance but will help theme designers create optimised CSS.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===The different layouts as of 17th August 2010===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_layouts_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Layout&lt;br /&gt;
! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| base&lt;br /&gt;
| Most backwards compatible layout without the blocks - this is the layout used by default.&lt;br /&gt;
|- &lt;br /&gt;
| standard&lt;br /&gt;
| Standard layout with blocks, this is recommended for most pages with general information.&lt;br /&gt;
|- &lt;br /&gt;
| course&lt;br /&gt;
| Main course page.&lt;br /&gt;
|- &lt;br /&gt;
| coursecategory&lt;br /&gt;
| Use for browsing through course categories.&lt;br /&gt;
|- &lt;br /&gt;
| incourse&lt;br /&gt;
| Default layout while browsing a course, typical for modules.&lt;br /&gt;
|- &lt;br /&gt;
| frontpage&lt;br /&gt;
| The site home page.&lt;br /&gt;
|- &lt;br /&gt;
| admin&lt;br /&gt;
| Administration pages and scripts.&lt;br /&gt;
|- &lt;br /&gt;
| mydashboard&lt;br /&gt;
| My dashboard page.&lt;br /&gt;
|- &lt;br /&gt;
| mypublic&lt;br /&gt;
| My public page.&lt;br /&gt;
|- &lt;br /&gt;
| login&lt;br /&gt;
| The login page.&lt;br /&gt;
|-&lt;br /&gt;
| popup&lt;br /&gt;
| Pages that appear in pop-up windows - no navigation, no blocks, no header.&lt;br /&gt;
|-&lt;br /&gt;
| frametop&lt;br /&gt;
| Used for legacy frame layouts only. No blocks and minimal footer.&lt;br /&gt;
|-&lt;br /&gt;
| embedded&lt;br /&gt;
| Embeded pages, like iframe/object embedded in moodleform - it needs as much space as possible&lt;br /&gt;
|-&lt;br /&gt;
| maintenance&lt;br /&gt;
| Used during upgrade and install. This must not have any blocks, and it is good idea if it does not have links to other places - for example there should not be a home link in the footer.&lt;br /&gt;
|-&lt;br /&gt;
| print&lt;br /&gt;
| Used when the page is being displayed specifically for printing.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Theme changes in 2.0]]&lt;br /&gt;
* [[Themes 2.0 creating your first theme]] - A quick step by step guide to creating your first theme.&lt;br /&gt;
* [[Themes 2.0 how to clone a Moodle 2.0 theme]]&lt;br /&gt;
* [[Themes 2.0 How to use images within your theme]] - Explains how to use and override images within your theme.&lt;br /&gt;
* [[Themes 2.0 adding a settings page]] - Looks at how to add a setting page making your theme easily customisable.&lt;br /&gt;
* [[Themes 2.0 extending the custom menu]] - Customising the custom menu.&lt;br /&gt;
* [[Themes 2.0 overriding a renderer]] - A tutorial on creating a custom renderer and changing the HTML Moodle produces.&lt;br /&gt;
* [[Themes 2.0 adding courses and categories to the custom menu]] - Extending the custom menu further adding all categories + courses&lt;br /&gt;
* [[Themes 2.0 how to make the dock horizontal]] - Modifying the dock to make it horizontal.&lt;br /&gt;
* [[Themes 2.0 adding upgrade code]]&lt;br /&gt;
* [[Styling and customising the dock]] - How to style and customise the dock.&lt;br /&gt;
* [[Themes 2.0 How to change &#039;Topic outline&#039; and &#039;Weekly outline&#039; to Page heading]]&lt;br /&gt;
* [[Using jQuery with Moodle 2.0]]&lt;br /&gt;
* [http://www.youtube.com/watch?v=OvaU54uh-qA New themes in Moodle 2.0 video]&lt;br /&gt;
===Moodle 2.2+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.2 how to clone a Moodle 2.2 theme]]&lt;br /&gt;
&lt;br /&gt;
===Moodle Bootstrap Themes - Moodle 2.5+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.5 How to copy and customise the Simple (bootstrap) theme]]&lt;br /&gt;
&lt;br /&gt;
[[de:Designs 2.0]]&lt;br /&gt;
[[es:Temas 2.0]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=39074</id>
		<title>Themes overview</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Themes_overview&amp;diff=39074"/>
		<updated>2013-04-17T15:51:40Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Theme options as of 17th April 2013 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}{{Moodle 2.0}}Welcome to the new world of themes in Moodle 2.0!&lt;br /&gt;
&lt;br /&gt;
A Moodle theme allows the user to change the look and feel of a Moodle site.  Themes can be applied on the site, category, course and activity levels by users with permissions to do so.  Themes can be designed for specific devices such as mobile phones or tablets. This page explains how themes work in Moodle and is intended to help you create or modify most themes for Moodle 2.0&lt;br /&gt;
&lt;br /&gt;
You can use contributed themes or create your entire own to share with the community. Themes can also be based on parent themes with only few customizations. Themes accomplish this using CSS, changing the underlying markup structure and also adding Javascript to add more advanced behaviors.&lt;br /&gt;
&lt;br /&gt;
Most theme developers simply add a few changes to their new theme by basing it on an existing one. The Moodle Theme architecture is designed in such a way whereby the base theme will act as a fall-back that is used when nothing has been defined in the theme based on it. This makes it easy to create new themes that simply seek out to make minor changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.4==&lt;br /&gt;
{{Moodle 2.4}}&lt;br /&gt;
&lt;br /&gt;
===HTML 5 doctype===&lt;br /&gt;
&lt;br /&gt;
By default Moodle is sending HTML5 doctype. Themes designers may decide to force old xhtml strict mode, but it is strongly discouraged and the site will not pass strictness validation. (MDL-34299)&lt;br /&gt;
&lt;br /&gt;
===Internet Explorer standards mode===&lt;br /&gt;
&lt;br /&gt;
Since 2.4 Moodle automatically sends X-UA-Compatible edge header, this should prevent Internet Explorer from switching to quirks or compatibility modes (MDL-36524). There is also a new workaround for intranet servers which previously identified recent IE browsers as IE7. (MDL-36481)&lt;br /&gt;
&lt;br /&gt;
===SVG icons===&lt;br /&gt;
&lt;br /&gt;
Most modern browsers support SVG icons. The benefit is that SVG scales perfectly to any screen resolution or zoom. It is now possible to add icons in SVG format to pix directories, Moodle uses SVG in supported browsers and PNG in legacy browsers. (MDL-22955)&lt;br /&gt;
&lt;br /&gt;
Please note that IE9 does not handle scaling of standard SVG icons properly, you may have to manually execute a special script from theme/base/cli/svgtool.php to alter the icons to be compatible with buggy IE9. (MDL-36436)&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.0==&lt;br /&gt;
&lt;br /&gt;
The theme system was completely redesigned in Moodle 2.0.  Known issues have been addressed and new features have been added to meet community requests.&lt;br /&gt;
&lt;br /&gt;
Unfortunately it was not possible to maintain backward compatibility, so all Moodle 1.x themes need to be recreated for Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
Major changes include:&lt;br /&gt;
* Clearer and more consistent CSS classes and IDs throughout all pages in Moodle&lt;br /&gt;
* Introduction of layout files (templates) describing overall layout HTML for many different types of pages in Moodle.&lt;br /&gt;
* Introduction of renderers, which produce the smaller &amp;quot;parts&amp;quot; of a HTML page.  Advanced themes can choose to override these too if they choose.&lt;br /&gt;
* Introduction of standard methods for adding Javascript to themes.&lt;br /&gt;
* Easier control over icons and images in Moodle.&lt;br /&gt;
* The old &amp;quot;standard&amp;quot; theme has been split into two themes:&lt;br /&gt;
**&#039;&#039;&#039;base&#039;&#039;&#039; - contains absolutely basic layout, and&lt;br /&gt;
**&#039;&#039;&#039;standard&#039;&#039;&#039; - which adds CSS to the base theme to make it look like the old standard theme.&lt;br /&gt;
* Performance tuning: In normal production mode CSS files are combined into a single optimised file, and both CSS and JavaScript files are minimised to ensure there are no wasted connections or traffic.  Files are heavily cached, but also versioned, so that users never need to clear their caches.&lt;br /&gt;
&lt;br /&gt;
==The structure of a theme==&lt;br /&gt;
&lt;br /&gt;
Some important things to know when building good themes:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;config.php&#039;&#039;&#039; - this file is required in every theme.  It defines configuration settings and definitions required to make the theme work in Moodle. These include theme, file, region, default region and options. &lt;br /&gt;
# &#039;&#039;&#039;Layouts and layout files&#039;&#039;&#039; -  in config.php there is one definition for each page type (see [[#theme_layouts_table|Appendix A: Theme layouts]] for a list of over 12 types).  Each page type definition tells Moodle which layout file will be used, what block regions this page type should display and so on.  The layout file contains the HTML and the minimum PHP required to display basic structure of pages. (If you know Moodle 1.9, it&#039;s like a combination of header.html and footer.html).&lt;br /&gt;
# &#039;&#039;&#039;The base theme&#039;&#039;&#039; - is not intended to be used for production sites.  It sets up the simplest possible generic layout and includes only CSS essential to that layout &#039;&#039;or&#039;&#039; to Moodle as a whole.  It tries not to make any unnecessary rules and makes as few assumptions as possible.  It&#039;s the perfect base on which to start designing a theme, as there are very few colours, borders, margins, and alignments to override.  You can just start adding what you need.&lt;br /&gt;
&lt;br /&gt;
===Files and folders===&lt;br /&gt;
A theme&#039;s files are placed in a folder with under moodle/theme folder and have subfolders. They are laid out like this:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Directory&lt;br /&gt;
! File&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| /config.php&lt;br /&gt;
| Contains all of the configuration and definitions for each theme&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| /lib.php &lt;br /&gt;
| Contains speciality classes and functions that are used by theme&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| /renderers.php &lt;br /&gt;
| Contains any custom renderers for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| /settings.php &lt;br /&gt;
| Contains custom theme settings. These local settings are defined by the theme allowing the theme user to easily alter something about the way it looks or operates. (eg a background colour, or a header image)&lt;br /&gt;
|-&lt;br /&gt;
| /javascript/ &lt;br /&gt;
| &lt;br /&gt;
| All specialty JavaScript files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /lang/ &lt;br /&gt;
| &lt;br /&gt;
| Any special language files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /layout/ &lt;br /&gt;
| &lt;br /&gt;
| Contains the layout files for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/ &lt;br /&gt;
| &lt;br /&gt;
| Contains any images the theme makes use of either in CSS or in the layout files.&lt;br /&gt;
|-&lt;br /&gt;
|  /pix&lt;br /&gt;
| /favicon.ico &lt;br /&gt;
| The favicon to display for this theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix&lt;br /&gt;
| /screenshot.jpg &lt;br /&gt;
| A screenshot of the theme to be displayed in on the theme selection screen.&lt;br /&gt;
|-&lt;br /&gt;
| /style &lt;br /&gt;
| &lt;br /&gt;
| Default location for CSS files.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|/*.css&lt;br /&gt;
|CSS files the theme requires&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are also several other places that stylesheets can be included from (see the CSS how and why section below).&lt;br /&gt;
&lt;br /&gt;
==Theme options==&lt;br /&gt;
All theme options are set within the config.php file for the theme.  The settings that are most used are: parents, sheets, layouts, and javascripts. Have a look at the &#039;&#039;&#039;[[#theme_options_table|theme options table]]&#039;&#039;&#039; for a complete list of theme options which include lesser used specialised or advanced settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Basic theme config example===&lt;br /&gt;
Lets have a look at a basic theme configuration file and the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;newtheme&#039;;&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;parents = array(&lt;br /&gt;
    &#039;base&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;admin&#039;,&lt;br /&gt;
    &#039;blocks&#039;,&lt;br /&gt;
    &#039;calendar&#039;,&lt;br /&gt;
    &#039;course&#039;,&lt;br /&gt;
    &#039;grade&#039;,&lt;br /&gt;
    &#039;message&#039;,&lt;br /&gt;
    &#039;question&#039;,&lt;br /&gt;
    &#039;user&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    )&lt;br /&gt;
    //.......&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;javascripts_footer = array(&lt;br /&gt;
    &#039;navigation&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic theme example settings explained===&lt;br /&gt;
First up you will notice everything is added to $THEME. This is the theme&#039;s configuration object, it is created by Moodle using default settings and is then updated by whatever settings you add to it.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;name : The first setting, is the theme&#039;s name. This should simply be whatever your theme&#039;s name is, most likely whatever you named your theme directory.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;parents : This defines the themes that the theme will extend. In this case it is extending only the base theme.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;sheets : An array containing the names of the CSS stylesheets to include for this theme. Note that it is just the name of the stylesheet and does not contain the directory or the file extension. Moodle assumes that the theme&#039;s stylesheets will be located in the styles directory of the theme and have .css as an extension.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;layouts : In this example, two layouts have been defined to override the layouts from the base theme. For more information see the [[#Layouts|layouts]] section below.&lt;br /&gt;
&lt;br /&gt;
; $THEME-&amp;gt;javascripts_footer : The final setting is to include a JavaScript file. Much like stylesheets, you only need to provide the files name. Moodle will assume it is in your themes JavaScript directory and be a .js file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: When you first begin writing themes, make sure you take a look at the configuration files of the other themes that get shipped with Moodle. You will get a good picture of how everything works, and what is going on in a theme, simply by reading it and taking notice of what it is including or excluding.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
===Locations of CSS files===&lt;br /&gt;
First lets look at where CSS can be included from within Moodle:&lt;br /&gt;
; \theme\themename\style\*.css : This is the default location for all of the stylesheets that are used by a theme and the place which should be used by a theme designer.&lt;br /&gt;
&lt;br /&gt;
New theme developers should note that the order in which CSS files are found and included creates a hierarchy.  This order ensures that the rules, within a theme&#039;s style sheets, take precedence over identical rules in other files that may have been introduced before.  This can both extend another files definitions (see parent array in the config file) and also ensures that the current theme&#039;s CSS rules/definitions have the last say.&lt;br /&gt;
&lt;br /&gt;
There are other locations that can be used (although very rarely) to include CSS in a page. A developer of a php file can manually specify a stylesheet from anywhere within Moodle, like the database. Usually, if code is doing this, it is because there is a non-theme config or plugin setting that contains information requires special CSS information.  As a theme designer you should be aware of, but not have to worry about, these locations of CSS files.  Here are some examples:&lt;br /&gt;
&lt;br /&gt;
; {pluginpath}\styles.css e.g. \block\blockname\styles.css or \mod\modname\styles.css : Every plugin can have its own styles.css file. This file should only contain the required CSS rules for the module and should not add anything to the look of the plugin such as colours, font sizes, or margins other than those that are truly required.&amp;lt;br /&amp;gt;Theme specific styles for a plugin should be located within the themes styles directory.&lt;br /&gt;
; {pluginpath}\styles_themename.css : This should only ever be used by plugin developers. It allows them to write CSS that is designed for a specific theme without having to make changes to that theme. You will notice that this is never used within Moodle and is designed to be used only by contributed code.&lt;br /&gt;
&lt;br /&gt;
As theme designers, we will only use the first method of introducing CSS: adding rules to a stylesheet file located in the theme&#039;s style directory.&lt;br /&gt;
&lt;br /&gt;
===Moodle&#039;s core CSS organisation===&lt;br /&gt;
The next thing to look at is the organisation of CSS and rules within a theme. Although as a theme designer it is entirely up to you as to how you create and organise your CSS. Please note that within the themes provided in the standard install by Moodle there is a very clear organisation of CSS.&lt;br /&gt;
&lt;br /&gt;
First is the  pagelayout.css file. This contains the CSS required to give the layouts their look and feel.  It doesn&#039;t contain any rules that affect the content generated by Moodle.&lt;br /&gt;
&lt;br /&gt;
Next is the core.css file. If you open up core you will notice that it contains all manner of general (usually simple) rules that don&#039;t relate to a specific section of Moodle but to Moodle as a whole.&lt;br /&gt;
&lt;br /&gt;
There can also be rules that relate to specific sections.  However, this is done only when there are only a handful of rules for that section. These small clusters of rules are grouped together and separated by comments identifying for which section each relates.&lt;br /&gt;
&lt;br /&gt;
Finally there are all the other CSS files, you will notice that there is a file for each section of Moodle that has a significant collection of rules.&lt;br /&gt;
&lt;br /&gt;
:For those who are familiar with Moodle 1.9 theme&#039;s, this organisation will be a big change. In 1.9, CSS was organised by its nature (for example: colours, layout, other).&lt;br /&gt;
&lt;br /&gt;
===How to write effective CSS rules within Moodle===&lt;br /&gt;
In Moodle 2.0, writing good CSS rules is incredibly important.&lt;br /&gt;
&lt;br /&gt;
Due to performance requirements and browser limitations, all of the CSS files are combined into a single CSS file that gets included every time. This means that rules need to be written in such a way as to minimise the chances of a collision leading to unwanted styles being applied. Whilst writing good CSS is something most designers strive for we have implemented several new body classes and prompt developers to use appropriate classnames.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;body&amp;gt; CSS id and classes ====&lt;br /&gt;
As of Moodle 2.0 the ID tag that gets applied to the body will always be a representation of the URI. For example if you are looking at a forum posting and the URI is &#039;/mod/forum/view.php&#039; then the body tags ID will be &#039;#page-mod-forum-view&#039;.&lt;br /&gt;
&lt;br /&gt;
As well as the body&#039;s ID attribute the URI is also exploded to form several CSS classes that get added to the body tag, so in the above example &#039;/mod/forum/view&#039; you would end up with the following classes being added to the body tag &#039;.path-mod&#039;, &#039;.path-mod-forum&#039;. Note that &#039;.path-mod-forum-view&#039; is not added as a class, this is intentionally left out to lessen confusion and duplication as rules can relate directly to the page by using the ID and do not require the final class.&lt;br /&gt;
&lt;br /&gt;
The body ID and body classes described above will form the bread and butter for many of the CSS rules you will need to write for your theme, however there are also several other very handy classes that get added to the body tag that will be beneficial to you once you start your journey down the rabbit hole that is themeing. Some of the more interesting classes are listed below.&lt;br /&gt;
&lt;br /&gt;
* If JavaScript is enabled then &#039;jsenabled&#039; will be added as a class to the body tag allowing you to style based on JavaScript being enabled or not.&lt;br /&gt;
* Either &#039;dir-rtl&#039; or &#039;dir-ltr&#039; will be added to the body as a class depending on the direction of the language pack: rtl = right to left, ltr = left to right. This allows you to determine your text-alignment based on language if required.&lt;br /&gt;
* A class will be added to represent the language pack currently in use, by default en_utf8 is used by Moodle and will result in the class &#039;lang-en_utf8&#039; being added to the body tag.&lt;br /&gt;
* The wwwroot for Moodle will also be converted to a class and added to the body tag allowing you to stylise your theme based on the URL through which it was reached. e.g. http://sam.moodle.local/moodle/ will become &#039;.sam-moodle-local—moodle&#039;&lt;br /&gt;
* If the current user is not logged then &#039;.notloggedin&#039; will be added to the body tag.&lt;br /&gt;
&lt;br /&gt;
What does all of this look like in practise? Well using the above example /mod/forum/view.php you would get at least the following body tag:&lt;br /&gt;
&amp;lt;code html4strict&amp;gt;&amp;lt;body id=”page-mod-forum-view” class=”path-mod path-mod-forum” /&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Writing your rules====&lt;br /&gt;
&lt;br /&gt;
By following the [[CSS coding style]] and CSS best-practices and understanding the [http://htmlhelp.com/reference/css/structure.html#cascade cascading order] of CSS a theme developer will reduce collisions and lines of CSS that is written. CSS classes have been placed where it is believed anyone may want to apply their own styles.&lt;br /&gt;
&lt;br /&gt;
When starting to write rules make sure that you have a good understanding of where you want those rules to be applied, it is a good idea to make the most of the body classes mentioned above.&lt;br /&gt;
If you want to write a rule for a specific page make use of the body tag&#039;s ID, e.g.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;#page-mod-forum-view .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to write a rule that will be applied all throughout the forum.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;.path-mod-forum .forumpost {&lt;br /&gt;
    border: 1px solid blue;&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The other very important thing to take into consideration is the structure leading up to the tag you want to style. Browsers apply conflicting styles with priority on the more specific selectors. It can be very beneficial to keep this in mind and write full selectors that rely on the structure of the tags leading to the tag you wish to style.&lt;br /&gt;
&lt;br /&gt;
By making use of body id&#039;s and classes and writing selectors to take into account the leading structure you can greatly minimise the chance of a collision both with Moodle now and in the future.&lt;br /&gt;
&lt;br /&gt;
==Layouts==&lt;br /&gt;
Layouts are defined in &#039;&#039;&#039;config.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
All themes are required to define the layouts they wish to be responsible for as well as create; however, many layout files are required by those layouts. If the theme is overriding another theme then it is a case of deciding which layouts this new theme should override. If the theme is a completely fresh start then you will need to define a layout for each of the different possibilities. &lt;br /&gt;
&lt;br /&gt;
It is also important to note that a new theme that will base itself on another theme (overriding it) does not need to define any layouts or use any layout files if there are no changes that it wishes to make to the layouts of the existing theme. The standard theme in Moodle is a good example of this as it extends the base theme simply adding CSS to achieve its look and feel.&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, layouts are defined in config.php within $THEME-&amp;gt;layouts. The following is an example of one such layout definition:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    // Standard layout with blocks, this is recommended for most pages with general information&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;base&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;&lt;br /&gt;
    )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The first thing Moodle looks at is the name of the layout, in this case it is `standard` (the array key in PHP), it then looks at the settings for the layout, this is the theme, file, regions, and default region. There are also a couple of other options that can be set by a layout.&lt;br /&gt;
&lt;br /&gt;
; theme : is the theme the layout file exists in. That&#039;s right: you can make use of layouts from other installed themes. &#039;&#039;Optional&#039;&#039;&lt;br /&gt;
; file : is the name of the layout file this layout wants to use. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; regions : is the different block regions (places you can put blocks) within the theme. &#039;&#039;Required&#039;&#039;&lt;br /&gt;
; defaultregion : is the default location when adding new blocks. &#039;&#039;&#039;Required if regions is non-empty, otherwise optional&#039;&#039;&#039;&lt;br /&gt;
; options : an array of layout specific options described in detail below. &#039;&#039;&#039;Optional&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;theme&#039;&#039;&#039; is optional. Normally the the layout file is looked for in the current theme, or, if it is not there, in the parent theme. However, you can use a layout file from any other theme by giving the theme name here.&lt;br /&gt;
&lt;br /&gt;
You can define whatever regions you like. You just need to pick a name for each one. Most themes just use one or both of &#039;&#039;&#039;side_pre&#039;&#039;&#039; and &#039;&#039;&#039;side_post&#039;&#039;&#039;, which is like &#039;left side&#039; and &#039;right side&#039;, except in right to left languages, when they are reversed. If you say in config.php that your the layout provides regions called &#039;fred&#039; and &#039;barney&#039;, then you must call $OUTPUT-&amp;gt;blocks_for_region(&#039;fred&#039;) and $OUTPUT-&amp;gt;blocks_for_region(&#039;barney&#039;) somewhere in the layout file.&lt;br /&gt;
&lt;br /&gt;
The final setting &#039;&#039;&#039;options&#039;&#039;&#039; is a special case that only needs to be set if you want to make use of it. This setting allows the theme designer to specify special options that they would like to create that can be later accessed within the layout file. This allows the theme to make design decisions during the definition and react upon those decisions in what ever layout file is being used.&lt;br /&gt;
&lt;br /&gt;
One such place this has been used is within the base theme. If you take a look first at theme/base/config.php you will notice that several layouts specify options &#039;&#039;&#039;nonavbar&#039;&#039;&#039; and &#039;&#039;&#039;nofooter&#039;&#039;&#039; which can both be set to either true or false. Then if we take a look at theme/base/layout/general.php you will spot lines like the following:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hasnavbar = (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar());&lt;br /&gt;
$hasfooter = (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;]));&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
............&lt;br /&gt;
&amp;lt;?php if ($hasnavbar) { ?&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
What you are seeing here is the use of those settings from the layout within the layout file. In this case it is being used to toggle the display of the navigation bar and page footer.&lt;br /&gt;
&lt;br /&gt;
==Layout files==&lt;br /&gt;
A layout file is a file that contains the core HTML structure for a layout including the header, footer, content and block regions. For those of you who are familiar with themes in Moodle 1.9 this is simply header.html and footer.html combined. Of course it is not all HTML, there are bits of HTML and content that Moodle needs to put into the page, within each layout file this will be done by a couple of simple PHP calls to get bits and pieces including content.&lt;br /&gt;
&lt;br /&gt;
Before learning more it is good to understand the two primary objects that will be used in your layout files: $OUTPUT and $PAGE.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$OUTPUT&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;core_renderer&amp;lt;/code&amp;gt; class which is defined in lib/outputrenderers.php. Each method is clearly documented there, along with which is appropriate for use within the layout files.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;$PAGE&#039;&#039;&#039; is an instance of the &amp;lt;code&amp;gt;moodle_page&amp;lt;/code&amp;gt; class defined in lib/pagelib.php. Most of the things you will want to use are the properties that are all documented at the top of the file. If you are not familiar with PHP properties, you access them like $PAGE-&amp;gt;activityname, just like fields of an ordinary PHP object. (However, behind the scenes the value you get is produced by calling a function. Also, you cannot change these values, they are &#039;&#039;&#039;read-only&#039;&#039;&#039;. However, you don&#039;t need to understand all that if you are just using these properties in your theme.)&lt;br /&gt;
&lt;br /&gt;
The following is a very simple layout file to illustrate the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid) ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses) ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;table id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
            &amp;lt;?php&lt;br /&gt;
            echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
            ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We assume you know enough HTML to understand the basic structure above, but let&#039;s explain the PHP code since that is less obvious.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This occurs at the VERY top of the page, it must be the first bit of output and is responsible for adding the (X)HTML document type definition to the page. This of course is determined by the settings of the site and is one of the things that the theme designer has no control over.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we have started writing the opening html tag and have asked Moodle to give us the HTML attributes that should be applied to it. This again is determined by several settings within the actual HTML install.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This gets us the title for the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This very important call gets us the standard head HTML that needs to be within the HEAD tag of the page. This is where CSS and JavaScript requirements for the top of the page will be output as well as any special script or style tags.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyid); ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php p($PAGE-&amp;gt;bodyclasses); ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Much like the html tag above we have started writing the body tag and have asked for Moodle to get us the desired ID and classes that should be applied to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading; ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are creating the header for the page. In this case we want the heading for the page, we want to display the login information which will be the current users username or a link to log in if they are not logged in, and we want the heading menu if there is one.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-pre&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is one of the most important calls within the file, it determines where the actual content for the page gets inserted.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-post&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This final bit of code gets the content for the footer of the page. It gets the login information which is the same as in the header, a home link, and the standard footer HTML which like the standard head HTML contains all of the script and style tags required by the page and requested to go in the footer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: Within Moodle 2.0 most of the JavaScript for the page will be included in the footer. This greatly helps reduce the loading time of the page.&lt;br /&gt;
&lt;br /&gt;
When writing layout files think about the different layouts and how the HTML that each makes use of will differ. You will most likely find you do not need a different layout file for each layout, most likely you will be able to reuse the layout files you create across several layouts. You can of course make use of layout options as well to further reduce the number of layout files you need to produce.&lt;br /&gt;
&lt;br /&gt;
Of course as mentioned above if you are customising an existing theme then you may not need to create any layouts or layout files at all.&lt;br /&gt;
&lt;br /&gt;
==Language File==&lt;br /&gt;
&lt;br /&gt;
You need to create a language file for your theme with a few standard strings in it. At a minimum create a file called lang/en/theme_themename.php in your theme folder. For example, the &#039;standard&#039; theme has a language file called lang/en/theme_standard.php. &lt;br /&gt;
&lt;br /&gt;
You &#039;&#039;&#039;must&#039;&#039;&#039; define the following lines in your file (example is from standard theme, adapt as required):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Standard&#039;;&lt;br /&gt;
$string[&#039;region-side-post&#039;] = &#039;Right&#039;;&lt;br /&gt;
$string[&#039;region-side-pre&#039;] = &#039;Left&#039;;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;This theme is a very basic white theme, with a minimum amount of &lt;br /&gt;
 CSS added to the base theme to make it actually usable.&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without the above you will get notices for the missing strings.&lt;br /&gt;
&lt;br /&gt;
==Making use of images==&lt;br /&gt;
Right at the start when listing the features of the new themes system one of the features mentioned was the ability to override any of the standard images within Moodle from within your theme. At this point we will look at both how to make use of your own images within your theme, and secondly how to override the images being used by Moodle.&lt;br /&gt;
So first up a bit about images within Moodle,&lt;br /&gt;
&lt;br /&gt;
# Images you want to use within your theme &#039;&#039;&#039;need&#039;&#039;&#039; to be located within your theme&#039;s pix directory.&lt;br /&gt;
# You can use sub directories within the pix directory of your theme.&lt;br /&gt;
# Images used by Moodle&#039;s core are located within the pix directory of Moodle.&lt;br /&gt;
# Modules, blocks and other plugins should also store their images within a pix directory.&lt;br /&gt;
&lt;br /&gt;
So making use of your own images first up. Lets assume you have added two image files to the pix directory of your theme.&lt;br /&gt;
&lt;br /&gt;
* /theme/yourthemename/pix/imageone.jpg&lt;br /&gt;
* /theme/yourthemename/pix/subdir/imagetwo.png&lt;br /&gt;
&lt;br /&gt;
Notice that one image is a JPEG image, and the second is a PNG. Also the second image is in a subdirectory.&lt;br /&gt;
&lt;br /&gt;
The following code snippet illustrates how to make use of your images within HTML, such as if you wanted to use them within a layout file.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;imageone&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;subdir/imagetwo&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT&#039;&#039;&#039; include the image file extension. Moodle will work it out automatically and it will not work if you do include it.&lt;br /&gt;
&lt;br /&gt;
In this case rather than writing out the URL to the image we use a method of Moodle&#039;s output library. Its not too important how that functions works but it is important that we use it as it is what allows images within Moodle to be over-rideable.&lt;br /&gt;
&lt;br /&gt;
The following is how you would use the images from within CSS as background images.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.divone {&lt;br /&gt;
    background-image: url([[pix:theme|imageone]]);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.divtwo {&lt;br /&gt;
    background-image: url([[pix:theme|subdir/imagetwo]]);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If this case we have to use some special notations that Moodle looks for. Whenever Moodle hands out a CSS file it first searches for all &#039;&#039;[[something]]&#039;&#039; tags and replaces them with what is required.&lt;br /&gt;
&lt;br /&gt;
The final thing to notice with both of the cases above is that at no point do we include the images file extension. &lt;br /&gt;
The reason for this leads us into the next topic, how to override images.&lt;br /&gt;
&lt;br /&gt;
From within a theme you can VERY easily override any standard image within Moodle by simply adding the replacement image to the theme&#039;s pix directory in the same sub directory structure as it is in Moodle.&lt;br /&gt;
So for instance we wanted to override the following two images:&lt;br /&gt;
# /pix/moodlelogo.gif&lt;br /&gt;
# /pix/i/user.gif&lt;br /&gt;
We would simply need to add our replacement images to the theme in the following locations&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.gif&lt;br /&gt;
# /theme/themename/pix_core/i/user.gif&lt;br /&gt;
&#039;&#039;Note that we have created a &#039;&#039;&#039;pix_core&#039;&#039;&#039; directory in our theme. For module images we need a &#039;&#039;&#039;pix_mod&#039;&#039;&#039; directory. See [[Themes_2.0_How_to_use_images_within_your_theme|using images within your theme]] for the full story.&lt;br /&gt;
&lt;br /&gt;
Now the other very cool thing to mention is that Moodle looks for not just replacements of the same image type (jpg, gif, etc...) but also replacements in any image format. This is why above when working with our images we never specified the images file extension.&lt;br /&gt;
This means that the following would also work:&lt;br /&gt;
# /theme/themename/pix_core/moodlelogo.png&lt;br /&gt;
# /theme/themename/pix_core/i/user.bmp&lt;br /&gt;
&lt;br /&gt;
For a more detailed description of how this all works see the page on [[Themes_2.0_How_to_use_images_within_your_theme|using images within your theme]]&lt;br /&gt;
&lt;br /&gt;
==Unobvious Things==&lt;br /&gt;
===Getting Your Theme to Appear Correctly in Theme Selector===&lt;br /&gt;
If you follow the examples on this page to the letter, when you go to the Theme Selector page you may be discouraged to find that your theme does not appear like the other themes do. In fact, instead of your theme&#039;s name, you will see something along the lines of &amp;lt;nowiki&amp;gt;[[pluginname]]&amp;lt;/nowiki&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
To correct this, you must add the theme/THEMENAME/lang/en/theme_THEMENAME.php file, where THEMENAME is the name of the theme folder. Inside that file, add the string &amp;quot;$string[&#039;pluginname&#039;] = &#039;THEMENAME&#039;; &amp;quot;. Make THEMENAME the name of your theme, however you want it displayed in the Theme selector.&lt;br /&gt;
&lt;br /&gt;
Also, make sure to change your config.php file and version.php file to reflect the correct name:&lt;br /&gt;
&lt;br /&gt;
In config.php: $THEME-&amp;gt;name = &#039;NAME&#039;;&lt;br /&gt;
&lt;br /&gt;
In version.php: $plugin-&amp;gt;component = &#039;theme_NAME&#039;; // Full name of the plugin (used for diagnostics)&lt;br /&gt;
&lt;br /&gt;
The screenshot for the theme should be about 500x400 px.&lt;br /&gt;
&lt;br /&gt;
===Required theme divs===&lt;br /&gt;
&lt;br /&gt;
Some parts of Moodle may rely on particular divs, for example the div with id &#039;page-header&#039;.&lt;br /&gt;
&lt;br /&gt;
Consequently all themes must include at least the divs (with the same ids) that are present in the &#039;base&#039; theme. &lt;br /&gt;
&lt;br /&gt;
Missing out these elements may result in unexpected behaviour within specific modules or other plugins.&lt;br /&gt;
&lt;br /&gt;
==Appendix A==&lt;br /&gt;
===Theme options as of 17th April 2013===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_options_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting&lt;br /&gt;
! Effect&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;csspostprocess&#039;&#039;&#039;&lt;br /&gt;
|  Allows the user to provide the name of a function that all CSS should be passed to before being delivered.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;editor_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include within the body of the editor.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;enable_dock&#039;&#039;&#039;&lt;br /&gt;
|  If set to true the side dock is enabled for blocks&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;hidefromselector&#039;&#039;&#039;&lt;br /&gt;
| Used to hide a theme from the theme selector (unless theme designer mode is on). Accepts true or false.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;filter_mediaplugin_colors&#039;&#039;&#039;&lt;br /&gt;
|  Used to control the colours used in the small media player for the filters&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array containing the names of JavaScript files located in /javascript/ to include in the theme. (gets included in the head)&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts_footer&#039;&#039;&#039;&lt;br /&gt;
|  As above but will be included in the page footer.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;larrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the left arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;layouts&#039;&#039;&#039;&lt;br /&gt;
|  An array setting the layouts for the theme&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;&#039;&#039;&#039;name&#039;&#039;&#039;&lt;br /&gt;
| Name of the theme. Most likely the name of the directory in which this file resides.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents&#039;&#039;&#039;&lt;br /&gt;
|  An array of themes to inherit from&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array of JavaScript files NOT to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets not to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;plugins_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of plugin sheets to ignore and not include.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;rarrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the right arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;renderfactory&#039;&#039;&#039;&lt;br /&gt;
|  Sets a custom render factory to use with the theme, used when working with custom renderers.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;resource_mp3player_colors&#039;&#039;&#039;&lt;br /&gt;
|  Controls the colours for the MP3 player&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include for this theme. Should be located in the theme&#039;s style directory.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;supportscssoptimisation&#039;&#039;&#039;&lt;br /&gt;
|  When set to &#039;FALSE&#039; then the theme will not be affected by the &#039;CSS Optimiser&#039;.  The &#039;CSS Optimiser&#039; is enabled in Development &amp;gt; Experimental &amp;gt; Experimental settings.  When it is enabled CSS will be run through an optimisation process before being cached. The optimiser processes the CSS removing duplicate rules and styles, as well as white space removable and reformatting. Please note turning this on at the same time as theme designer mode is awful for performance but will help theme designers create optimised CSS.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===The different layouts as of August 17th, 2010===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_layouts_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Layout&lt;br /&gt;
! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| base&lt;br /&gt;
| Most backwards compatible layout without the blocks - this is the layout used by default.&lt;br /&gt;
|- &lt;br /&gt;
| standard&lt;br /&gt;
| Standard layout with blocks, this is recommended for most pages with general information.&lt;br /&gt;
|- &lt;br /&gt;
| course&lt;br /&gt;
| Main course page.&lt;br /&gt;
|- &lt;br /&gt;
| coursecategory&lt;br /&gt;
| Use for browsing through course categories.&lt;br /&gt;
|- &lt;br /&gt;
| incourse&lt;br /&gt;
| Default layout while browsing a course, typical for modules.&lt;br /&gt;
|- &lt;br /&gt;
| frontpage&lt;br /&gt;
| The site home page.&lt;br /&gt;
|- &lt;br /&gt;
| admin&lt;br /&gt;
| Administration pages and scripts.&lt;br /&gt;
|- &lt;br /&gt;
| mydashboard&lt;br /&gt;
| My dashboard page.&lt;br /&gt;
|- &lt;br /&gt;
| mypublic&lt;br /&gt;
| My public page.&lt;br /&gt;
|- &lt;br /&gt;
| login&lt;br /&gt;
| The login page.&lt;br /&gt;
|-&lt;br /&gt;
| popup&lt;br /&gt;
| Pages that appear in pop-up windows - no navigation, no blocks, no header.&lt;br /&gt;
|-&lt;br /&gt;
| frametop&lt;br /&gt;
| Used for legacy frame layouts only. No blocks and minimal footer.&lt;br /&gt;
|-&lt;br /&gt;
| embedded&lt;br /&gt;
| Embeded pages, like iframe/object embedded in moodleform - it needs as much space as possible&lt;br /&gt;
|-&lt;br /&gt;
| maintenance&lt;br /&gt;
| Used during upgrade and install. This must not have any blocks, and it is good idea if it does not have links to other places - for example there should not be a home link in the footer.&lt;br /&gt;
|-&lt;br /&gt;
| print&lt;br /&gt;
| Used when the page is being displayed specifically for printing.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Theme changes in 2.0]]&lt;br /&gt;
* [[Themes 2.0 creating your first theme]] - A quick step by step guide to creating your first theme.&lt;br /&gt;
* [[Themes 2.0 how to clone a Moodle 2.0 theme]]&lt;br /&gt;
* [[Themes 2.0 How to use images within your theme]] - Explains how to use and override images within your theme.&lt;br /&gt;
* [[Themes 2.0 adding a settings page]] - Looks at how to add a setting page making your theme easily customisable.&lt;br /&gt;
* [[Themes 2.0 extending the custom menu]] - Customising the custom menu.&lt;br /&gt;
* [[Themes 2.0 overriding a renderer]] - A tutorial on creating a custom renderer and changing the HTML Moodle produces.&lt;br /&gt;
* [[Themes 2.0 adding courses and categories to the custom menu]] - Extending the custom menu further adding all categories + courses&lt;br /&gt;
* [[Themes 2.0 how to make the dock horizontal]] - Modifying the dock to make it horizontal.&lt;br /&gt;
* [[Themes 2.0 adding upgrade code]]&lt;br /&gt;
* [[Styling and customising the dock]] - How to style and customise the dock.&lt;br /&gt;
* [[Themes 2.0 How to change &#039;Topic outline&#039; and &#039;Weekly outline&#039; to Page heading]]&lt;br /&gt;
* [[Using jQuery with Moodle 2.0]]&lt;br /&gt;
* [http://www.youtube.com/watch?v=OvaU54uh-qA New themes in Moodle 2.0 video]&lt;br /&gt;
===Moodle 2.2+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.2 how to clone a Moodle 2.2 theme]]&lt;br /&gt;
&lt;br /&gt;
===Moodle Bootstrap Themes - Moodle 2.5+===&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.5 How to copy and customise the Simple (bootstrap) theme]]&lt;br /&gt;
&lt;br /&gt;
[[de:Designs 2.0]]&lt;br /&gt;
[[es:Temas 2.0]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Hack-a-thon_2013&amp;diff=37937</id>
		<title>Talk:Hack-a-thon 2013</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Hack-a-thon_2013&amp;diff=37937"/>
		<updated>2013-02-23T11:37:51Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Created page with &amp;quot;With reference to https://moodle.org/mod/forum/discuss.php?d=222697 - could there be a task for plugins to remove theme specific css?  Also for contributed plugin&amp;#039;s, how about &amp;#039;c...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;With reference to https://moodle.org/mod/forum/discuss.php?d=222697 - could there be a task for plugins to remove theme specific css?&lt;br /&gt;
&lt;br /&gt;
Also for contributed plugin&#039;s, how about &#039;code checking&#039;(https://moodle.org/plugins/view.php?plugin=local_codechecker) the latest version, cleaning it and getting the author to make an update?  Say 3 points for every plugin updated, verified by the author and T-Shirt for every two plugins cleaned, verified and updated on the plugin&#039;s / add-on&#039;s database?&lt;br /&gt;
&lt;br /&gt;
--[[User:Gareth Barnard|Gareth Barnard]] 19:37, 23 February 2013 (WST)&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Course_formats&amp;diff=37609</id>
		<title>Course formats</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Course_formats&amp;diff=37609"/>
		<updated>2013-02-05T11:31:12Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Creating a New Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Course formats are plugins that determine the layout of [[:en:Course|course]] resources. &lt;br /&gt;
&lt;br /&gt;
Course formats determine how the course main page looks like (/course/view.php) in both view and editing mode. They are also responsible for building navigation tree inside the course (displayed to user in navigation block and breadcrumb). They can organise the course content in sections. Course creator or teacher can specify course format for the course in course edit form. &lt;br /&gt;
&lt;br /&gt;
Moodle 2.4 and above: Course formats also can add it&#039;s own options fields to the course edit form. They can add course dependend content to header/footer of any page inside the course, not only /course/view.php&lt;br /&gt;
 &lt;br /&gt;
=Components=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/FORMATNAME/lang/en/format_FORMATNAME.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Contains the English language strings used in the format. You can also define strings for other languages.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/FORMATNAME/config.php&#039;&#039;&#039; (deprecated since 2.4)&lt;br /&gt;
&lt;br /&gt;
Contains $format[&#039;defaultblocks&#039;] which defines the default blocks loaded with the format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/FORMATNAME/format.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is is the layout itself. It is included in course/view.php.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/FORMATNAME/lib.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The main library of the format. In Moodle versions up to 2.3 it should contain implementations of course format callbacks. In versions 2.4 and above it should contain a class format_FORMATNAME extending format_base. Also it may contain callbacks for other core and contributed APIs if necessary&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/FORMATNAME/styles.css&#039;&#039;&#039;, &#039;&#039;&#039;styles_THEMENAME.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Optional stylesheet. Note that this file is included on all pages on the site, even in the courses that use other formats. In 2.4+ the class format-FORMATNAME is automatically added to body for all pages inside the course, it is recommended to prefix all directives in your styles.css with body.format-FORMATNAME &lt;br /&gt;
&lt;br /&gt;
File styles.css will be included always, styles_THEMENAME.css only if theme_THEMENAME is used for the site (or for the course).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/FORMATNAME/settings.php&#039;&#039;&#039; (version 2.4 and above)&lt;br /&gt;
&lt;br /&gt;
Optional plugin administrative settings. See &amp;quot;Individual settings&amp;quot; in [[Admin settings]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/FORMATNAME/renderer.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Optional but very recommended file containing renderer for this course format. This file will contain &#039;&#039;class format_FORMATNAME_renderer extends plugin_renderer_base&#039;&#039;. See [[Output renderers]]&lt;br /&gt;
&lt;br /&gt;
Since course format is all about the display it is very important to separate HTML and PHP. All HTML code should be in your format_FORMATNAME_renderer class in renderer.php. Ideally format.php will only call one function from renderer. Use of renderer is required if you want to output content header and footer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/FORMATNAME/version.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version definitions, see [[version.php]]. It is highly recommended always to have it and it is required if you have any files in db folder&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/db/install.xml&#039;&#039;&#039;, &#039;&#039;&#039;course/format/db/install.php&#039;&#039;&#039;, &#039;&#039;&#039;course/format/db/upgrade.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Definitions of tables used by this plugin and upgrade script, see [[Upgrade API]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/backup/&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Implementation of backup and restore for additional tables defined in your plugin. See [[Backup API]]. This is only needed if you define additional tables in your db folder. Data from table course_format_options is backed up for your plugin automatically&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course/format/db/access.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Capabilities introduced by this plugin, see [[Access API]]. Please note that if you define new capabilities inside course format they should not affect accessibility of course modules because other components (for example reports and/or gradebook) will not know about them&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Javascript and YUI files&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Also course format may contain Javascript files and/or YUI modules. See [[:Category:Javascript]] for documentation. Make sure that course format checks course_ajax_enabled() before including AJAX libraries&lt;br /&gt;
&lt;br /&gt;
=Creating a New Format=&lt;br /&gt;
The easiest way to create a new course format is to copy an existing one.&lt;br /&gt;
&lt;br /&gt;
1. Copy the folder containing the format files.&lt;br /&gt;
&lt;br /&gt;
2. Rename the folder to the new name. Course format names cannot exceed 21 characters. (In Moodle 2.3 and below the limit is 10 characters)&lt;br /&gt;
&lt;br /&gt;
3. Rename language files in &#039;&#039;course/format/FORMATNAME/lang/&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
4. Change &#039;&#039;$string[&#039;pluginname&#039;]&#039;&#039; in &#039;&#039;course/format/FORMATNAME/lang/en/format_FORMATNAME.php&#039;&#039; to the new name.&lt;br /&gt;
&lt;br /&gt;
5. Moodle 2.3 and below: Rename callback functions in lib.php. The names of the functions is formed as callback_FORMATNAME_CALLBACKNAME()&lt;br /&gt;
&lt;br /&gt;
Moodle 2.4 and above: Rename class name in lib.php to format_FORMATNAME.&lt;br /&gt;
&lt;br /&gt;
6. Search and replace other occurences of the old format name, for example in renderer, capabilities names, settings, javascript libraries, etc.&lt;br /&gt;
&lt;br /&gt;
7. The new format is ready for modification.&lt;br /&gt;
&lt;br /&gt;
8. After modifying the code, check it with the &#039;Code checker [https://moodle.org/plugins/view.php?plugin=local_codechecker]&#039;.&lt;br /&gt;
&lt;br /&gt;
=Upgrading format to the next Moodle version=&lt;br /&gt;
&lt;br /&gt;
Read the files course/format/upgrade.txt, lib/upgrade.txt and also upgrade.txt of the core APIs that you use in your course format plugin and make changes according to them. When testing don&#039;t forget to enable Developer debugging level and error display (Settings-&amp;gt;Developer-&amp;gt;Debugging)&lt;br /&gt;
&lt;br /&gt;
If you upgrade your course format plugin from Moodle 2.3 to Moodle 2.4 - copy class format_legacy to your lib.php and rename it to format_FORMATNAME. Then go through the class functions and replace calling of functions with the corresponding callbacks&#039; code. Move blocks list from config.php to the function format_FORMATNAME::get_default_blocks()&lt;br /&gt;
&lt;br /&gt;
=Developing course formats for Moodle 2.4 and above=&lt;br /&gt;
&lt;br /&gt;
File lib.php in your course format will contain &#039;&#039;class format_FORMATNAME extends format_base&#039;&#039;. The parent class is located in course/format/lib.php and has detailed PHPdocs for each functions that you can override. Some functions are defined as &#039;&#039;final&#039;&#039; and you can not override them. Some functions such as get_course(), get_format_options(), update_format_options() and get_renderer() usually do not need to be overriden unless you know exactly what you are doing.&lt;br /&gt;
&lt;br /&gt;
Here are the main features in course formats and responsible for them format_base functions&lt;br /&gt;
&lt;br /&gt;
==Course sections==&lt;br /&gt;
&lt;br /&gt;
There is existing functionality in Moodle core to support organising course modules into sections. Course format plugins do not have to use them but the most of them do. Database table {course_sections} stores basic information about sections. Also sections info is cached and returned by get_fast_modinfo() so every action changing the sections must be followed by rebuild_course_cache(). Course module must always belong to the section. Even if your course format does not use sections, the section with number 0 is always created. &lt;br /&gt;
&lt;br /&gt;
You must define $string[&#039;sectionname&#039;] if your language file even if format does not use sections because it can be called unconditionally from other parts of the code, even though it won&#039;t be displayed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! format_base method in 2.4+&lt;br /&gt;
! description&lt;br /&gt;
! Moodle 2.3- callback&lt;br /&gt;
|-&lt;br /&gt;
| uses_sections()&lt;br /&gt;
| returns true or false if the format uses sections or not. There is a global function course_format_uses_secions() that invokes it. It affects default navigation tree building. Various modules and reports may call this function to know whether to display section name for the particular module or not.&lt;br /&gt;
| callback_FORMATNAME_uses_sections()&lt;br /&gt;
|-&lt;br /&gt;
| get_section_name()&lt;br /&gt;
| Returns the name for particular section. This function may be called often so it should use only fields cached in section_info object (field course_sections.name is always cached)&lt;br /&gt;
| callback_FORMATNAME_get_section_name()&lt;br /&gt;
|-&lt;br /&gt;
| get_view_url()&lt;br /&gt;
| Returns the URL for particular section, it can be either anchor on course view page or separate page. See parent function PHPdocs for more details&lt;br /&gt;
| 2.3 only: callback_FORMATNAME_get_section_url(). Prior to Moodle 2.3 sections could not have separate URLs&lt;br /&gt;
|-&lt;br /&gt;
| is_section_current()&lt;br /&gt;
| Specifies if the section is current, for example current week or highlighted topic. This function is only used if your renderer uses it for example if your renderer extends format_section_renderer_base. This function is not called from anywhere else in Moodle core.&lt;br /&gt;
| format_section_renderer_base::is_section_current()&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==AJAX support in course format==&lt;br /&gt;
&lt;br /&gt;
There are features in core that course format may use or ban, for example modchooser (activity chooser), inline edit of module title, drag and drop of sections, activities and blocks on the page, drag and drop files to the course page to create activities.&lt;br /&gt;
&lt;br /&gt;
There is also a global setting $CFG-&amp;gt;enableajax that admin can disable via config.php or in Settings block that will disable AJAX even if course format allows it.&lt;br /&gt;
&lt;br /&gt;
If you have additional AJAX functionality in course format plugin, you must check course_ajax_enabled() before including it.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! format_base method in 2.4+&lt;br /&gt;
! description&lt;br /&gt;
! Moodle 2.3-&lt;br /&gt;
|-&lt;br /&gt;
| supports_ajax()&lt;br /&gt;
| returns the minimum versions for browsers that support AJAX. Usually it is enough to copy the function code from format_topics&lt;br /&gt;
| callback_FORMATNAME_ajax_support()&lt;br /&gt;
|-&lt;br /&gt;
| ajax_section_move()&lt;br /&gt;
| code executed after sections were rearranged using drag and drop. See example in format_topics where sections have automatic names depending on their sequence number&lt;br /&gt;
| callback_FORMATNAME_ajax_section_move()&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Default blocks==&lt;br /&gt;
&lt;br /&gt;
Course format can specify which blocks should be added to the course page when course is created in this format.&lt;br /&gt;
&lt;br /&gt;
If course format is changed during course edit, blocks are not changed.&lt;br /&gt;
&lt;br /&gt;
Whatever course format specifies in the method, site admin can override it with $CFG-&amp;gt;defaultblocks_override or $CFG-&amp;gt;defaultblocks_FORMATNAME&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! format_base method in 2.4+&lt;br /&gt;
! description&lt;br /&gt;
! Moodle 2.3-&lt;br /&gt;
|-&lt;br /&gt;
| get_default_blocks()&lt;br /&gt;
| see PHPdocs in format_base class&lt;br /&gt;
| file config.php with $format[&#039;defaultblocks&#039;] in it&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Extending course navigation==&lt;br /&gt;
&lt;br /&gt;
Node for the course will be created in navigationlib for you and all standard available branches like &#039;Participants&#039; or &#039;Reports&#039; will be added to it. After that course format can add nodes for sections and modules. There is a default implementation that adds branches for course sections and modules under them. Or if course format does not use sections, all modules will just be placed under course mode. Course format is able to override the default navigation tree building. &lt;br /&gt;
&lt;br /&gt;
Note that if navigationlib can not find the node for the current course module, the node will be added automatically (after this callback).&lt;br /&gt;
&lt;br /&gt;
The breadcrumb that appears on the top of the page also reads navigation tree.&lt;br /&gt;
&lt;br /&gt;
You can see examples of overriding course navigation in [https://moodle.org/plugins/view.php?plugin=format_singleactivity format_singleactivity] and [https://moodle.org/plugins/view.php?plugin=format_flexsections format_flexsections]. In Single activity we pretend that course node is the activity node and in Flexible sections the sections are added to the navigation tree hierarchically.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! format_base method in 2.4+&lt;br /&gt;
! description&lt;br /&gt;
! Moodle 2.3-&lt;br /&gt;
|-&lt;br /&gt;
| extend_course_navigation()&lt;br /&gt;
| See PHPdocs in format_base class. This function is called when navigation tree is built on the page and also when user expands non-active node in navigation via AJAX request. Only the node with active section should be expanded, do not add children nodes to not expanded nodes (for example do not add nodes for modules in collapsed sections)&lt;br /&gt;
| callback_FORMATNAME_display_content(), callback_FORMATNAME_load_content()&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Course format options==&lt;br /&gt;
The core table &#039;&#039;&#039;{course_format_options}&#039;&#039;&#039; in Moodle database is designed to store additional options for course formats. This may be options for the whole course or options for course section.&lt;br /&gt;
&lt;br /&gt;
Course format options must not have the same names as fields in database table {course}, section options must not have the same names as fields in {course_sections}. Also make sure names do not duplicate completion and conditional fields in edit forms.&lt;br /&gt;
&lt;br /&gt;
Some facts about course format options in core classes:&lt;br /&gt;
&lt;br /&gt;
* Core formats &#039;&#039;format_weeks&#039;&#039; and &#039;&#039;format_topics&#039;&#039; have options: &#039;&#039;numsections&#039;&#039;, &#039;&#039;hiddensections&#039;&#039;, &#039;&#039;coursedisplay&#039;&#039;. They are also defined as default in class &#039;&#039;format_legacy&#039;&#039; because prior to 2.4 they were fields in {course} table and were part of course edit form. &lt;br /&gt;
* Class &#039;&#039;format_base&#039;&#039; by default does not define any options.&lt;br /&gt;
* Core formats &#039;&#039;format_social&#039;&#039; and &#039;&#039;format_scorm&#039;&#039; do not have have any options.&lt;br /&gt;
* Neither core course format uses additional section options. [https://moodle.org/plugins/view.php?plugin=format_flexsections Flexible sections format] has a section option &amp;quot;display collapsed/expanded&amp;quot; and it is also defined as cached because it affects often-called function get_view_url()&lt;br /&gt;
&lt;br /&gt;
When teacher &#039;&#039;&#039;changes the course format&#039;&#039;&#039; in the course edit form AND the old and the new course formats share the same option name, the value of this option is copied from one format to another. For example, if course had format Topics and had 8 sections in it and teacher changes format to weeks, the course will have 8 weeks in it.&lt;br /&gt;
&lt;br /&gt;
During &#039;&#039;&#039;backup&#039;&#039;&#039; the course format options are stored as if they were additional fields in {course} table. Therefore courses in topics and weeks formats that were backed up in Moodle 2.3 will be restored in 2.4 without data loss even though the values of numsections, hiddensections and coursedisplay will be stored in another table. &#039;&#039;&#039;Do not store IDs of elements&#039;&#039;&#039; (courses, sections, etc.) in course format options because they will not be backed up and restored properly. You can use section numbers because they are relative inside the course. If absolute ids are necessary you can create your own backup/restore scripts, see [[Backup API]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Webservices&#039;&#039;&#039; expect course format options to be passed in additional entity but for backward compartibility numsections, hiddensections and coursedisplay can also be passed as if they were fields in {course} table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! format_base method in 2.4+&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| get_course()&lt;br /&gt;
| (no need to override) returns object with all fields from db table {course} AND all course format options&lt;br /&gt;
|-&lt;br /&gt;
| get_section()&lt;br /&gt;
| (no need to override) returns instance of section_info. It will contain all fields from table {course_sections} AND all course format options for this section&lt;br /&gt;
|-&lt;br /&gt;
| course_format_options()&lt;br /&gt;
| By overriding this method course format specifies which additional options it has for course&lt;br /&gt;
|-&lt;br /&gt;
| section_format_options()&lt;br /&gt;
| By overriding this method course format specifies which additional options it has for course section. Note that since section information is cached you may want to cache some additional options as well. See PHPdocs for more information&lt;br /&gt;
|-&lt;br /&gt;
| get_format_options()&lt;br /&gt;
| (usually no need to override) low level function to retrieve course format options values. It is more convenient to use methods get_course() and get_section()&lt;br /&gt;
|-&lt;br /&gt;
| create_edit_form_elements()&lt;br /&gt;
| This function is called to alter course edit form and standard section edit form. The default implementation creates simple form elements for each option defined in either course_format_options() or section_format_options(). Overwrite it if you want to have more comprehensive form elements or if you do not want options to appear in edit forms, etc.&lt;br /&gt;
|-&lt;br /&gt;
| edit_form_validation()&lt;br /&gt;
| Overwrite if course format plugin needs additional validation for it&#039;s option in course edit form&lt;br /&gt;
|-&lt;br /&gt;
| update_format_options()&lt;br /&gt;
| (usually no need to override) low level function to insert/update records in db table {course_format_options}&lt;br /&gt;
|-&lt;br /&gt;
| update_course_format_options()&lt;br /&gt;
| updates course format options with the data from the edit course form. Plugin can override for example to include calculated options fields, especially when course format is being changed. For example format_topics and format_weeks automatically fill field numsections when user switches from other format&lt;br /&gt;
|-&lt;br /&gt;
| update_section_format_options()&lt;br /&gt;
| updates course format options for the section with the data from edit section form&lt;br /&gt;
|-&lt;br /&gt;
| editsection_form()&lt;br /&gt;
| Return an instance of moodleform to edit a specified section. Default implementation returns instance of editsection_form that automatically adds additional fields defined in section_format_options()&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Executing code before output==&lt;br /&gt;
&lt;br /&gt;
It is often needed to execute some code before output started. You may want to&lt;br /&gt;
* redirect from one page to another. Examples are format_scorm format_singleactivity that don&#039;t have course view page and redirect /course/view.php to module view page&lt;br /&gt;
* perform an action that results in changes in navigation tree or other output. Example is when /course/view.php has a parameter in query that tells to change section visibility&lt;br /&gt;
* include additional JS or CSS files in the page head rather than body&lt;br /&gt;
&lt;br /&gt;
File format.php is included after the output is started and the above cases can not be solved inside it.&lt;br /&gt;
&lt;br /&gt;
Every module or page inside a course must call require_login() or $PAGE-&amp;gt;set_cm() or $PAGE-&amp;gt;set_course(). As soon as page knows the current module and/or course, the callbacks from current course format are invoked.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! format_base method in 2.4+&lt;br /&gt;
! description&lt;br /&gt;
|-&lt;br /&gt;
| page_set_cm()&lt;br /&gt;
| Override if you want to execute some code when course module is set for the page&lt;br /&gt;
|-&lt;br /&gt;
| page_set_course()&lt;br /&gt;
| Override if you want to execute some code when course is set for the page. This function is always invoked on any course page&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Additional footer or header on any page inside the course==&lt;br /&gt;
&lt;br /&gt;
Course format may add content header and footer to any page inside the course (including modules pages). They will be displayed right above or below the page main content, right or left from side blocks. Also course formats may add course header and footer. They will be displayed above or below both content and blocks. Typical usages may be:&lt;br /&gt;
* course navigation (prev/next/back)&lt;br /&gt;
* course custom menu&lt;br /&gt;
* disclaimer information or other text in the bottom of each course page&lt;br /&gt;
* etc&lt;br /&gt;
&lt;br /&gt;
This is a new feature in Moodle 2.4, you have to make sure that if the site uses the custom theme, it supports it. Refer to theme/upgrade.txt. Also theme may specify that some pagelayouts (report, print, etc) do NOT display the course header/footer.&lt;br /&gt;
&lt;br /&gt;
Using this functionality REQUIRES use of renderers. &#039;&#039;&#039;Example&#039;&#039;&#039; of using the course headers/footers you can find in tracker issue MDL-36048&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! format_base method in 2.4+&lt;br /&gt;
! description&lt;br /&gt;
|-&lt;br /&gt;
| course_content_header()&lt;br /&gt;
| Returns content to be displayed immediately above the page content in the main area (between side blocks)&lt;br /&gt;
|-&lt;br /&gt;
| course_content_footer()&lt;br /&gt;
| Returns content to be displayed immediately below the page content in the main area (between side blocks)&lt;br /&gt;
|-&lt;br /&gt;
| course_header()&lt;br /&gt;
| Returns content to be displayed above all content, usually below heading and above breadcrumb but it depends on the theme&lt;br /&gt;
|-&lt;br /&gt;
| course_footer()&lt;br /&gt;
| Returns content to be displayed below content and blocks, usually above the page footer, exact poisition depends on the theme&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Handling events==&lt;br /&gt;
&lt;br /&gt;
As any other plugin types course formats can listen to system events. See [[Events API]]. Examples of events that format may listen to:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;course_created&#039;&#039;&#039; - when course is created. Usually not necessary because format_FORMATNAME::update_course_format_options() is called with null as second argument&lt;br /&gt;
* &#039;&#039;&#039;course_updated&#039;&#039;&#039; - when course is updated. Again format_FORMATNAME::update_course_format_options() is called. But if user changed format from A to B the function from format B is invoked. In this case if format A wants to remove some data it should listen to event;&lt;br /&gt;
* &#039;&#039;&#039;course_deleted&#039;&#039;&#039; - when course is deleted. Format may want to remove some data (all data from course_format_options is removed automatically)&lt;br /&gt;
* &#039;&#039;&#039;mod_created&#039;&#039;&#039; - course module created&lt;br /&gt;
* &#039;&#039;&#039;mod_updated&#039;&#039;&#039; - course module updated&lt;br /&gt;
* &#039;&#039;&#039;mod_deleted&#039;&#039;&#039; - course module deleted&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Course_format_ideas&amp;diff=34875</id>
		<title>Course format ideas</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Course_format_ideas&amp;diff=34875"/>
		<updated>2012-08-16T19:54:53Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Good section to section navigation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a page set up in response to comments in this forum post: http://moodle.org/mod/forum/discuss.php?d=208789#p910726  It may take a number of iterations to get to where was want.&lt;br /&gt;
&lt;br /&gt;
Former discussions: &lt;br /&gt;
#Possibility of getting Folderview into Moodle: http://moodle.org/mod/forum/discuss.php?d=175758#p772469&lt;br /&gt;
#Martin&#039;s post, prior to 2.3: http://moodle.org/mod/forum/discuss.php?d=200470#p874588&lt;br /&gt;
#Marty&#039;s 2008 post: http://moodle.org/mod/forum/discuss.php?d=102680&lt;br /&gt;
#Course formats at present: a summary from Moodle News http://www.moodlenews.com/course-formats/&lt;br /&gt;
&lt;br /&gt;
There are several factors.&lt;br /&gt;
#Legacy issues&lt;br /&gt;
#Getting a nice solution into the core.  As Mary says, we don&#039;t all have the benefit of an IT department, and hosted solutions cost a lot to customise.&lt;br /&gt;
#Creating flexibility fo plugin writers.&lt;br /&gt;
#??&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==Navigation Issues==&lt;br /&gt;
1.9 to version 2 brought the navigation menu.  In some respects this attempts to do everything.  We have site navigation, course navigation and section navigation in one block.  Almost an alternative scroll of death.&lt;br /&gt;
&lt;br /&gt;
2.2 to 2.3 brought us a course level choice of a new layout option.  Single sections and All sections on one page.  Somehow the drop down list of sections was removed, whether this is a feature or an ommission is unclear.  As an immediate fix in 2.3.x I&#039;d like to see it back.  Much like in this post.  http://moodle.org/mod/forum/discuss.php?d=208789#p910618&lt;br /&gt;
&lt;br /&gt;
==Contributed Formats==&lt;br /&gt;
#Folder view - see http://moodle.org/plugins/view.php?plugin=format_folderview&lt;br /&gt;
#Flexpage (Now back on the scene for 2.2 but not 2.3, see http://moodle.org/mod/forum/discuss.php?d=208789#p911219)&lt;br /&gt;
#Collapsed Topics - see http://moodle.org/plugins/view.php?plugin=format_topcoll&lt;br /&gt;
#Grid - see http://moodle.org/plugins/view.php?plugin=format_grid and http://tracker.moodle.org/browse/CONTRIB-3769&lt;br /&gt;
#Onetopic - see http://moodle.org/plugins/view.php?plugin=format_onetopic&lt;br /&gt;
#Easypost - see http://moodle.org/plugins/view.php?plugin=format_easypost&lt;br /&gt;
#Topics (colours) - see http://moodle.org/plugins/view.php?plugin=format_colours&lt;br /&gt;
#Weekly reversed - see http://moodle.org/plugins/view.php?plugin=format_weeksrev&lt;br /&gt;
&lt;br /&gt;
See: https://docs.moodle.org/dev/Talk:Paged_course_formats&lt;br /&gt;
&lt;br /&gt;
==General principles==&lt;br /&gt;
ie what are the ways we should be thinking about this?&lt;br /&gt;
===Good section to section navigation===&lt;br /&gt;
Consistently available ie there, in general, without having to scroll (as is the case regularly with inside course navigation in the Nav menu).&lt;br /&gt;
  &lt;br /&gt;
One option: a menu at the top left.  &lt;br /&gt;
*examples: http://moodle.org/mod/forum/discuss.php?d=175758#p873291 &lt;br /&gt;
http://moodle.org/pluginfile.php/554/mod_forum/post/873291/Pic1.png&lt;br /&gt;
*a plugin: http://moodle.org/mod/forum/discuss.php?d=169107&lt;br /&gt;
*Itamars version: http://moodle.org/mod/forum/discuss.php?d=208789#p910618 and his comments: http://moodle.org/mod/forum/discuss.php?d=200470#p874588 (from an old post)&lt;br /&gt;
http://moodle.org/pluginfile.php/155/mod_forum/post/910639/sections-vav.png&lt;br /&gt;
*Another version from Itamar http://moodle.org/pluginfile.php/155/mod_forum/post/910618/itamarsectionformat.png&lt;br /&gt;
&lt;br /&gt;
IMO, this simple section&amp;lt;&amp;gt;section navigation as and option in core is essential.  It takes care of the basic/simple course course, makes navigation in your face and intuitive.  I don&#039;t like personally having too much in this.  I like it really clean.  Comments?  --[[User:Derek Chirnside|Derek Chirnside]] 12:01, 16 August 2012 (WST)  Note: I have done the code patch for this for core, see http://tracker.moodle.org/browse/MDL-34917 - [[User:Gareth Barnard|Gareth Barnard]] 03:54, 17 August 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
===Ability to tag the current section as current===&lt;br /&gt;
This is needed especially for the courses done on a week by week basis.  You may have a navigation scrolling, but who cares in this case?  Highlight this week, with a previous and next and I think it works OK.  Then there is the problem of too much content for one week.  The subpage module maybe of use here? --[[User:Derek Chirnside|Derek Chirnside]] 12:01, 16 August 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
===No scrolling to see the section to section navigation===&lt;br /&gt;
ie the Navigation menu option isn&#039;t enough.&lt;br /&gt;
&lt;br /&gt;
Comments: &amp;quot;Regarding the SoD in the Navigation block, I think a very easy improvement to the in-course navigation would be to simply break out that navigation from the My Courses tree into its own tree.  That way users can easily navigate within the course as well as between courses, but aren&#039;t hit with too much information with large course lists.&amp;quot; from Kris Stokking http://moodle.org/mod/forum/discuss.php?d=208789#p911219&lt;br /&gt;
&lt;br /&gt;
IMO there are too many levels in the Navigation Menu: Site, (Course), Sectionns, Section content.  I&#039;d like to see Course &amp;gt; Sections only.  I don&#039;t mind scrolling within a well defined, sell structured section.  --[[User:Derek Chirnside|Derek Chirnside]] 12:01, 16 August 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
==Other approaches==&lt;br /&gt;
&lt;br /&gt;
===Comments on Grid idea===&lt;br /&gt;
&lt;br /&gt;
===Comments on Collapsed sections approadh===&lt;br /&gt;
&lt;br /&gt;
===Horizontal, in section navigation===&lt;br /&gt;
Basically, my suggestion.  http://moodle.org/mod/forum/discuss.php?d=208789#p910650 --[[User:Derek Chirnside|Derek Chirnside]] 12:01, 16 August 2012 (WST)&lt;br /&gt;
http://moodle.org/pluginfile.php/155/mod_forum/post/910650/Ideal%20Navigation.jpg&lt;br /&gt;
&lt;br /&gt;
===What else?===&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Course_format_ideas&amp;diff=34874</id>
		<title>Course format ideas</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Course_format_ideas&amp;diff=34874"/>
		<updated>2012-08-16T19:50:37Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Contributed Formats */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a page set up in response to comments in this forum post: http://moodle.org/mod/forum/discuss.php?d=208789#p910726  It may take a number of iterations to get to where was want.&lt;br /&gt;
&lt;br /&gt;
Former discussions: &lt;br /&gt;
#Possibility of getting Folderview into Moodle: http://moodle.org/mod/forum/discuss.php?d=175758#p772469&lt;br /&gt;
#Martin&#039;s post, prior to 2.3: http://moodle.org/mod/forum/discuss.php?d=200470#p874588&lt;br /&gt;
#Marty&#039;s 2008 post: http://moodle.org/mod/forum/discuss.php?d=102680&lt;br /&gt;
#Course formats at present: a summary from Moodle News http://www.moodlenews.com/course-formats/&lt;br /&gt;
&lt;br /&gt;
There are several factors.&lt;br /&gt;
#Legacy issues&lt;br /&gt;
#Getting a nice solution into the core.  As Mary says, we don&#039;t all have the benefit of an IT department, and hosted solutions cost a lot to customise.&lt;br /&gt;
#Creating flexibility fo plugin writers.&lt;br /&gt;
#??&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==Navigation Issues==&lt;br /&gt;
1.9 to version 2 brought the navigation menu.  In some respects this attempts to do everything.  We have site navigation, course navigation and section navigation in one block.  Almost an alternative scroll of death.&lt;br /&gt;
&lt;br /&gt;
2.2 to 2.3 brought us a course level choice of a new layout option.  Single sections and All sections on one page.  Somehow the drop down list of sections was removed, whether this is a feature or an ommission is unclear.  As an immediate fix in 2.3.x I&#039;d like to see it back.  Much like in this post.  http://moodle.org/mod/forum/discuss.php?d=208789#p910618&lt;br /&gt;
&lt;br /&gt;
==Contributed Formats==&lt;br /&gt;
#Folder view - see http://moodle.org/plugins/view.php?plugin=format_folderview&lt;br /&gt;
#Flexpage (Now back on the scene for 2.2 but not 2.3, see http://moodle.org/mod/forum/discuss.php?d=208789#p911219)&lt;br /&gt;
#Collapsed Topics - see http://moodle.org/plugins/view.php?plugin=format_topcoll&lt;br /&gt;
#Grid - see http://moodle.org/plugins/view.php?plugin=format_grid and http://tracker.moodle.org/browse/CONTRIB-3769&lt;br /&gt;
#Onetopic - see http://moodle.org/plugins/view.php?plugin=format_onetopic&lt;br /&gt;
#Easypost - see http://moodle.org/plugins/view.php?plugin=format_easypost&lt;br /&gt;
#Topics (colours) - see http://moodle.org/plugins/view.php?plugin=format_colours&lt;br /&gt;
#Weekly reversed - see http://moodle.org/plugins/view.php?plugin=format_weeksrev&lt;br /&gt;
&lt;br /&gt;
See: https://docs.moodle.org/dev/Talk:Paged_course_formats&lt;br /&gt;
&lt;br /&gt;
==General principles==&lt;br /&gt;
ie what are the ways we should be thinking about this?&lt;br /&gt;
===Good section to section navigation===&lt;br /&gt;
Consistently available ie there, in general, without having to scroll (as is the case regularly with inside course navigation in the Nav menu).&lt;br /&gt;
  &lt;br /&gt;
One option: a menu at the top left.  &lt;br /&gt;
*examples: http://moodle.org/mod/forum/discuss.php?d=175758#p873291 &lt;br /&gt;
http://moodle.org/pluginfile.php/554/mod_forum/post/873291/Pic1.png&lt;br /&gt;
*a plugin: http://moodle.org/mod/forum/discuss.php?d=169107&lt;br /&gt;
*Itamars version: http://moodle.org/mod/forum/discuss.php?d=208789#p910618 and his comments: http://moodle.org/mod/forum/discuss.php?d=200470#p874588 (from an old post)&lt;br /&gt;
http://moodle.org/pluginfile.php/155/mod_forum/post/910639/sections-vav.png&lt;br /&gt;
*Another version from Itamar http://moodle.org/pluginfile.php/155/mod_forum/post/910618/itamarsectionformat.png&lt;br /&gt;
&lt;br /&gt;
IMO, this simple section&amp;lt;&amp;gt;section navigation as and option in core is essential.  It takes care of the basic/simple course course, makes navigation in your face and intuitive.  I don&#039;t like personally having too much in this.  I like it really clean.  Comments?  --[[User:Derek Chirnside|Derek Chirnside]] 12:01, 16 August 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
===Ability to tag the current section as current===&lt;br /&gt;
This is needed especially for the courses done on a week by week basis.  You may have a navigation scrolling, but who cares in this case?  Highlight this week, with a previous and next and I think it works OK.  Then there is the problem of too much content for one week.  The subpage module maybe of use here? --[[User:Derek Chirnside|Derek Chirnside]] 12:01, 16 August 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
===No scrolling to see the section to section navigation===&lt;br /&gt;
ie the Navigation menu option isn&#039;t enough.&lt;br /&gt;
&lt;br /&gt;
Comments: &amp;quot;Regarding the SoD in the Navigation block, I think a very easy improvement to the in-course navigation would be to simply break out that navigation from the My Courses tree into its own tree.  That way users can easily navigate within the course as well as between courses, but aren&#039;t hit with too much information with large course lists.&amp;quot; from Kris Stokking http://moodle.org/mod/forum/discuss.php?d=208789#p911219&lt;br /&gt;
&lt;br /&gt;
IMO there are too many levels in the Navigation Menu: Site, (Course), Sectionns, Section content.  I&#039;d like to see Course &amp;gt; Sections only.  I don&#039;t mind scrolling within a well defined, sell structured section.  --[[User:Derek Chirnside|Derek Chirnside]] 12:01, 16 August 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
==Other approaches==&lt;br /&gt;
&lt;br /&gt;
===Comments on Grid idea===&lt;br /&gt;
&lt;br /&gt;
===Comments on Collapsed sections approadh===&lt;br /&gt;
&lt;br /&gt;
===Horizontal, in section navigation===&lt;br /&gt;
Basically, my suggestion.  http://moodle.org/mod/forum/discuss.php?d=208789#p910650 --[[User:Derek Chirnside|Derek Chirnside]] 12:01, 16 August 2012 (WST)&lt;br /&gt;
http://moodle.org/pluginfile.php/155/mod_forum/post/910650/Ideal%20Navigation.jpg&lt;br /&gt;
&lt;br /&gt;
===What else?===&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Gareth_Barnard&amp;diff=33260</id>
		<title>User:Gareth Barnard</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Gareth_Barnard&amp;diff=33260"/>
		<updated>2012-04-12T13:22:47Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Created page with &amp;quot;Please see my [http://moodle.org/user/profile.php?id=442195 Moodle user profile] for full details.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please see my [http://moodle.org/user/profile.php?id=442195 Moodle user profile] for full details.&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=33259</id>
		<title>Talk:Paged course formats</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=33259"/>
		<updated>2012-04-12T13:20:26Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Some thoughts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
What is the general idea of &#039;Paged course formats&#039;? - Will it be that you get to see the section name as a list, then if you wish to view it opens in a new tab within the browser?&lt;br /&gt;
&lt;br /&gt;
==Discussions around this==&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=175758#p770737 &lt;br /&gt;
&lt;br /&gt;
==Some of the options currently around for alternative formats==&lt;br /&gt;
Representing several different approaches.&lt;br /&gt;
#http://server3.moodle.com/browse/MDL-28555&lt;br /&gt;
&lt;br /&gt;
===FOLDERVIEW===&lt;br /&gt;
Doed much more than just offer page view.  Eiting magic as well.&lt;br /&gt;
#Folderview Blog post: http://thinkingdistance.org/post/6486856003/folderview-course-format&lt;br /&gt;
#Comments by Michael: http://server3.moodle.com/browse/MDL-27646  Including Folderview in Moodle 2&lt;br /&gt;
&lt;br /&gt;
Paul&#039;s comment: &amp;quot;Paul Chapin added a comment - 07/Jun/11 3:20 AM : The folder view format doesn&#039;t really do it. Basically, that&#039;s just a topic format with a different interface. It doesn&#039;t deal with the situation of the instructor who wants to make a large amount of reference information, usually files and web links, available as part of a topic or week without visually overwhelming the students. By allowing for a hierarchical structuring of material using folders the amount of information the student is presented with at any given time can be limited and organized logically. It&#039;s really files and links that we want, but if that&#039;s implemented, adding the rest of the resource types should be fairly straight forward&amp;quot;  MDL-27646&lt;br /&gt;
&lt;br /&gt;
===FLEXPAGE===&lt;br /&gt;
Unsure of status for 2.&lt;br /&gt;
#Flexipage and Moodle 2.0: http://moodle.org/mod/forum/discuss.php?d=83817#p74318&lt;br /&gt;
&lt;br /&gt;
===COLLAPSED===&lt;br /&gt;
Three forms: Topics, Weeks and Latest First&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_topcoll - Same as Topic&#039;s format but with a &#039;toggle&#039; and a cookie to remember state per user per course that can be persistent.  Developed much further - see CONTRIB-3378 below.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_weekcoll - Same as Week&#039;s format but with a &#039;toggle&#039; as above.&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_latfirst - Same as above but current week is displayed first and preceding weeks after for the user.  In &#039;editing&#039; mode it is the same as Collapsed Weeks.&lt;br /&gt;
&lt;br /&gt;
Combined into one:&lt;br /&gt;
#CONTRIB-3378&lt;br /&gt;
Which has four forms: Topics, Weeks, Latest Week First and Current Topic First.  Available from [http://moodle.org/plugins/view.php?plugin=format_topcoll Modules &amp;amp; Plugin&#039;s Database] and documented on [https://docs.moodle.org/22/en/Collapsed_Topics_course_format Collapsed Topics Course Format]&lt;br /&gt;
&lt;br /&gt;
Above collapsed forms developed by [http://moodle.org/user/profile.php?id=442195 Gareth J Barnard].&lt;br /&gt;
&lt;br /&gt;
===BLOCK===&lt;br /&gt;
Experimental jQuery Masonry (#http://masonry.desandro.com/) format for Moodle 2.1:&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_topmas - Uses the jQuery Masonry plugin to arrange sections as close together as possible.  Resizes automatically depending on content.&lt;br /&gt;
&lt;br /&gt;
===GRID===&lt;br /&gt;
Not strictly a &amp;quot;paged format&amp;quot; But getting very good reviews.  Looks classy.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_grid Seems a good option&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The Grid Format was originally contributed by Paul Krix. It has since been updated and is now maintained ny Pukunui Technology. This format adds a more graphical interface to viewing Moodle topics and also avoids the &amp;quot;scroll of death&amp;quot; issue by using placeholder graphics to represent each topic. When clicked upon, these graphics launch the topics in ajax windows&amp;quot; from https://github.com/moodleman/moodle-courseformat_grid&lt;br /&gt;
&lt;br /&gt;
===COURSE MENU===&lt;br /&gt;
There are at least two in plugins:&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
Plus Lei Zhang (and Awesome Moodle) bar&lt;br /&gt;
&lt;br /&gt;
Catalyst have coded two options included in Moodle in Schools package.&lt;br /&gt;
&lt;br /&gt;
==Section Menu Option==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OU format option==&lt;br /&gt;
&lt;br /&gt;
== Some thoughts ==&lt;br /&gt;
&lt;br /&gt;
1. For weekly courses, one page per section is not necessarily ideal. Instead the OU course format (studyplanner) by default just shows the current week (highlighted) with +- n weeks either side. There is then a link &#039;Show entire study planner&#039; if you need to find something else. Section 0 is always visible. I think this is a good model (speaking as an OU student here). However, the &#039;mdl_course.coursedisplay&#039; proposal, with just two settings, does nothing to make this easier. Therefore, I am skeptical about the value of hard-coding that into Moodle core.--[[User:Tim Hunt|Tim Hunt]] 20:09, 12 April 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
2. Even if you press on with your plan, it seems silly to just list the weeks on the course front page in weekly format. Surely it is worth displaying the current week in full there. It will save students one click almost every time they visit the course.--[[User:Tim Hunt|Tim Hunt]] 20:09, 12 April 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
3. Has anyone at HQ actually downloaded and installed the OU&#039;s subpage module? I know it solves a separate problem, but please spend some time looking at it now for two reasons. A. When you do the &amp;quot;Check for regressions in modules caused by course assumptions&amp;quot; bit, you should try to ensure that they benefit modules like subpage, as well as your course format changes. B. Subpage functionality might be worth adding to Moodle too, and the code already exists and works.--[[User:Tim Hunt|Tim Hunt]] 20:09, 12 April 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
4. Be very careful when defining format_renderer_base. If you have format_weekly_renderer extends format_renderer_base, and format_renderer_base generates output for something, then a theme cannot do theme_mytheme_format_renderer cannot usefully extend format_renderer_base to change the output, because format_weekly_renderer still extends format_renderer_base, and not theme_mytheme_format_renderer. (I made this mistake in a few small ways with question_type_renderer base, e.g. the feedback_image mehthod, although I mostly got it right by creating core_question_renderer to output the common parts of questions.) Basically, prefer composition over inheritance (http://c2.com/cgi/wiki?CompositionInsteadOfInheritance).--[[User:Tim Hunt|Tim Hunt]] 20:09, 12 April 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
5. I am worried that you are trying to do this in a rush before the 2.3 deadline, particularly if you are not going to delay mdl_course.coursedisplay until 2.4. It occurs to me that a lot of this could be done initially in third-party course-format plugins. Then, once everyone can see it working, and has been bowled over by how amazing it is (assuming you are right, and I am wrong) you can then refactor the code into Moodle core.--[[User:Tim Hunt|Tim Hunt]] 20:09, 12 April 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
5.1 I disagree with Tim over implementing initially in third-party course-format plugins.  As this is a &#039;core&#039; functionality change it should be implemented there as &#039;gospel&#039; way of implementing the functionality so that there is no confusion over interpretation of how it should work.  Because if each contrib developer takes their &#039;view&#039; then we will have a mismash that will have to be sorted and then the contrib developers have to refactor back to the HQ defined standard.  I don&#039;t live and breathe PHP or Moodle (sacrilege I know) so tend to follow and adapt the &#039;guru&#039; written code in the core formats as a basis of learning and implementing the correct functionality, hence I consider a core &#039;guru gospel&#039; implementation to be the better solution. [[User:Gareth Barnard|Gareth Barnard]] 21:20, 12 April 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
5.2 I do agree with the thought of it being rushed as although I consider a lot of users have been screaming for this for ages, it would be better to get it right first time even if this takes a little longer.  As a bodge job could put users off Moodle completely and cause them to lose faith in the quality of the product. [[User:Gareth Barnard|Gareth Barnard]] 21:20, 12 April 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
6. We have not yet published the Moodle 2.x code for the studyplanner course format, but if anyone want to see it, we can probably share it. Just ask.--[[User:Tim Hunt|Tim Hunt]] 20:11, 12 April 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
7. Do we really want the course format options to be part of the already very long and complex course settings form. Whey not have a separate link in the settings block for &#039;Weekly format options&#039;, or something like that. Much simpler all round.--[[User:Tim Hunt|Tim Hunt]] 20:13, 12 April 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
8. I override the function &#039;section_class.prototype.swap_with_section&#039; in &#039;/lib/ajax/section_classes.js&#039; in the contributed &#039;Collapsed Topics&#039; course format because I use a table for my layout and hence two table rows per section.  Therefore, will I still be able to do this?  Before I get blamed for using a &#039;table&#039; tag instead of a &#039;div&#039; tag and a set of &#039;ul&#039; tags, tables work for me because the layout is tabular and conceptually is a table in the Object Orientated sense (bar the three/four/more legs), and indeed the W3C specification of a &#039;[http://www.w3.org/TR/html4/struct/tables.html table]&#039; states &#039;The HTML table model allows authors to arrange data -- text, preformatted text, images, links, forms, form fields, other tables, etc. -- into rows and columns of cells.&#039; and that is exactly what I am doing as an arrangement of the sections as rows and columnar subdivision of content / section information.  It also works better with Internet Explorer and manipulating the Document Object Model with JavaScript at the client end. [[User:Gareth Barnard|Gareth Barnard]] 21:20, 12 April 2012 (WST)&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32965</id>
		<title>Talk:Paged course formats</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32965"/>
		<updated>2012-03-22T18:17:38Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* COLLAPSED */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
What is the general idea of &#039;Paged course formats&#039;? - Will it be that you get to see the section name as a list, then if you wish to view it opens in a new tab within the browser?&lt;br /&gt;
&lt;br /&gt;
==Discussions around this==&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=175758#p770737 &lt;br /&gt;
&lt;br /&gt;
==Some of the options currently around for alternative formats==&lt;br /&gt;
Representing several different approaches.&lt;br /&gt;
#http://server3.moodle.com/browse/MDL-28555&lt;br /&gt;
&lt;br /&gt;
===FOLDERVIEW===&lt;br /&gt;
Doed much more than just offer page view.  Eiting magic as well.&lt;br /&gt;
#Folderview Blog post: http://thinkingdistance.org/post/6486856003/folderview-course-format&lt;br /&gt;
#Comments by Michael: http://server3.moodle.com/browse/MDL-27646  Including Folderview in Moodle 2&lt;br /&gt;
&lt;br /&gt;
Paul&#039;s comment: &amp;quot;Paul Chapin added a comment - 07/Jun/11 3:20 AM : The folder view format doesn&#039;t really do it. Basically, that&#039;s just a topic format with a different interface. It doesn&#039;t deal with the situation of the instructor who wants to make a large amount of reference information, usually files and web links, available as part of a topic or week without visually overwhelming the students. By allowing for a hierarchical structuring of material using folders the amount of information the student is presented with at any given time can be limited and organized logically. It&#039;s really files and links that we want, but if that&#039;s implemented, adding the rest of the resource types should be fairly straight forward&amp;quot;  MDL-27646&lt;br /&gt;
&lt;br /&gt;
===FLEXPAGE===&lt;br /&gt;
Unsure of status for 2.&lt;br /&gt;
#Flexipage and Moodle 2.0: http://moodle.org/mod/forum/discuss.php?d=83817#p74318&lt;br /&gt;
&lt;br /&gt;
===COLLAPSED===&lt;br /&gt;
Three forms: Topics, Weeks and Latest First&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_topcoll - Same as Topic&#039;s format but with a &#039;toggle&#039; and a cookie to remember state per user per course that can be persistent.  Developed much further - see CONTRIB-3378 below.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_weekcoll - Same as Week&#039;s format but with a &#039;toggle&#039; as above.&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_latfirst - Same as above but current week is displayed first and preceding weeks after for the user.  In &#039;editing&#039; mode it is the same as Collapsed Weeks.&lt;br /&gt;
&lt;br /&gt;
Combined into one:&lt;br /&gt;
#CONTRIB-3378&lt;br /&gt;
Which has four forms: Topics, Weeks, Latest Week First and Current Topic First.  Available from [http://moodle.org/plugins/view.php?plugin=format_topcoll Modules &amp;amp; Plugin&#039;s Database] and documented on [https://docs.moodle.org/22/en/Collapsed_Topics_course_format Collapsed Topics Course Format]&lt;br /&gt;
&lt;br /&gt;
Above collapsed forms developed by [http://moodle.org/user/profile.php?id=442195 Gareth J Barnard].&lt;br /&gt;
&lt;br /&gt;
===BLOCK===&lt;br /&gt;
Experimental jQuery Masonry (#http://masonry.desandro.com/) format for Moodle 2.1:&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_topmas - Uses the jQuery Masonry plugin to arrange sections as close together as possible.  Resizes automatically depending on content.&lt;br /&gt;
&lt;br /&gt;
===GRID===&lt;br /&gt;
Not strictly a &amp;quot;paged format&amp;quot; But getting very good reviews.  Looks classy.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_grid Seems a good option&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The Grid Format was originally contributed by Paul Krix. It has since been updated and is now maintained ny Pukunui Technology. This format adds a more graphical interface to viewing Moodle topics and also avoids the &amp;quot;scroll of death&amp;quot; issue by using placeholder graphics to represent each topic. When clicked upon, these graphics launch the topics in ajax windows&amp;quot; from https://github.com/moodleman/moodle-courseformat_grid&lt;br /&gt;
&lt;br /&gt;
===COURSE MENU===&lt;br /&gt;
There are at least two in plugins:&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
Plus Lei Zhang (and Awesome Moodle) bar&lt;br /&gt;
&lt;br /&gt;
Catalyst have coded two options included in Moodle in Schools package.&lt;br /&gt;
&lt;br /&gt;
==Section Menu Option==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OU format option==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32613</id>
		<title>Talk:Paged course formats</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32613"/>
		<updated>2012-02-28T10:39:31Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
What is the general idea of &#039;Paged course formats&#039;? - Will it be that you get to see the section name as a list, then if you wish to view it opens in a new tab within the browser?&lt;br /&gt;
&lt;br /&gt;
==Discussions around this==&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=175758#p770737 &lt;br /&gt;
&lt;br /&gt;
==Some of the options currently around for alternative formats==&lt;br /&gt;
Representing several different approaches.&lt;br /&gt;
#http://server3.moodle.com/browse/MDL-28555&lt;br /&gt;
&lt;br /&gt;
===FOLDERVIEW===&lt;br /&gt;
Doed much more than just offer page view.  Eiting magic as well.&lt;br /&gt;
#Folderview Blog post: http://thinkingdistance.org/post/6486856003/folderview-course-format&lt;br /&gt;
#Comments by Michael: http://server3.moodle.com/browse/MDL-27646  Including Folderview in Moodle 2&lt;br /&gt;
&lt;br /&gt;
Paul&#039;s comment: &amp;quot;Paul Chapin added a comment - 07/Jun/11 3:20 AM : The folder view format doesn&#039;t really do it. Basically, that&#039;s just a topic format with a different interface. It doesn&#039;t deal with the situation of the instructor who wants to make a large amount of reference information, usually files and web links, available as part of a topic or week without visually overwhelming the students. By allowing for a hierarchical structuring of material using folders the amount of information the student is presented with at any given time can be limited and organized logically. It&#039;s really files and links that we want, but if that&#039;s implemented, adding the rest of the resource types should be fairly straight forward&amp;quot;  MDL-27646&lt;br /&gt;
&lt;br /&gt;
===FLEXPAGE===&lt;br /&gt;
Unsure of status for 2.&lt;br /&gt;
#Flexipage and Moodle 2.0: http://moodle.org/mod/forum/discuss.php?d=83817#p74318&lt;br /&gt;
&lt;br /&gt;
===COLLAPSED===&lt;br /&gt;
Three forms: Topics, Weeks and Latest First&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_topcoll - Same as Topic&#039;s format but with a &#039;toggle&#039; and a cookie to remember state per user per course that can be persistent.  Developed much further - see CONTRIB-3378 below.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_weekcoll - Same as Week&#039;s format but with a &#039;toggle&#039; as above.&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_latfirst - Same as above but current week is displayed first and preceding weeks after for the user.  In &#039;editing&#039; mode it is the same as Collapsed Weeks.&lt;br /&gt;
&lt;br /&gt;
Soon all to be combined into one:&lt;br /&gt;
#CONTRIB-3378&lt;br /&gt;
Which now has four forms: Topics, Weeks, Latest Week First and Current Topic First.&lt;br /&gt;
&lt;br /&gt;
Above collapsed forms developed by [http://moodle.org/user/profile.php?id=442195 Gareth J Barnard].&lt;br /&gt;
&lt;br /&gt;
===BLOCK===&lt;br /&gt;
Experimental jQuery Masonry (#http://masonry.desandro.com/) format for Moodle 2.1:&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_topmas - Uses the jQuery Masonry plugin to arrange sections as close together as possible.  Resizes automatically depending on content.&lt;br /&gt;
&lt;br /&gt;
===GRID===&lt;br /&gt;
Not strictly a &amp;quot;paged format&amp;quot; But getting very good reviews.  Looks classy.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_grid Seems a good option&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The Grid Format was originally contributed by Paul Krix. It has since been updated and is now maintained ny Pukunui Technology. This format adds a more graphical interface to viewing Moodle topics and also avoids the &amp;quot;scroll of death&amp;quot; issue by using placeholder graphics to represent each topic. When clicked upon, these graphics launch the topics in ajax windows&amp;quot; from https://github.com/moodleman/moodle-courseformat_grid&lt;br /&gt;
&lt;br /&gt;
===COURSE MENU===&lt;br /&gt;
There are at least two in plugins:&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
Plus Lei Zhang (and Awesome Moodle) bar&lt;br /&gt;
&lt;br /&gt;
Catalyst have coded two options included in Moodle in Schools package.&lt;br /&gt;
&lt;br /&gt;
==Section Menu Option==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OU format option==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32510</id>
		<title>Talk:Paged course formats</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32510"/>
		<updated>2012-02-25T22:01:30Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* BLOCK */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What is the general idea of &#039;Paged course formats&#039;? - Will it be that you get to see the section name as a list, then if you wish to view it opens in a new tab within the browser?  I now have extensive course format development skills (and I hope enough Git knowledge) - can I help with writing the code for Moodle core?  I&#039;m [http://moodle.org/user/profile.php?id=442195 Gareth J Barnard] - developer of the Collapsed Topics / Weeks course formats.&lt;br /&gt;
&lt;br /&gt;
==Discussions around this==&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=175758#p770737 &lt;br /&gt;
&lt;br /&gt;
==Some of the options currently around for alternative formats==&lt;br /&gt;
Representing several different approaches.&lt;br /&gt;
#http://server3.moodle.com/browse/MDL-28555&lt;br /&gt;
&lt;br /&gt;
===FOLDERVIEW===&lt;br /&gt;
Doed much more than just offer page view.  Eiting magic as well.&lt;br /&gt;
#Folderview Blog post: http://thinkingdistance.org/post/6486856003/folderview-course-format&lt;br /&gt;
#Comments by Michael: http://server3.moodle.com/browse/MDL-27646  Including Folderview in Moodle 2&lt;br /&gt;
&lt;br /&gt;
Paul&#039;s comment: &amp;quot;Paul Chapin added a comment - 07/Jun/11 3:20 AM : The folder view format doesn&#039;t really do it. Basically, that&#039;s just a topic format with a different interface. It doesn&#039;t deal with the situation of the instructor who wants to make a large amount of reference information, usually files and web links, available as part of a topic or week without visually overwhelming the students. By allowing for a hierarchical structuring of material using folders the amount of information the student is presented with at any given time can be limited and organized logically. It&#039;s really files and links that we want, but if that&#039;s implemented, adding the rest of the resource types should be fairly straight forward&amp;quot;  MDL-27646&lt;br /&gt;
&lt;br /&gt;
===FLEXPAGE===&lt;br /&gt;
Unsure of status for 2.&lt;br /&gt;
#Flexipage and Moodle 2.0: http://moodle.org/mod/forum/discuss.php?d=83817#p74318&lt;br /&gt;
&lt;br /&gt;
===COLLAPSED===&lt;br /&gt;
Three forms: Topics, Weeks and Latest First&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_topcoll - Same as Topic&#039;s format but with a &#039;toggle&#039; and a cookie to remember state per user per course that can be persistent.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_weekcoll - Same as Week&#039;s format but with a &#039;toggle&#039; as above.&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_latfirst - Same as above but current week is displayed first and preceding weeks after for the user.  In &#039;editing&#039; mode it is the same as Collapsed Weeks.&lt;br /&gt;
&lt;br /&gt;
Soon all to be combined into one:&lt;br /&gt;
#http://tracker.moodle.org/browse/CONTRIB-3378&lt;br /&gt;
&lt;br /&gt;
===BLOCK===&lt;br /&gt;
Experimental jQuery Masonry (#http://masonry.desandro.com/) format for Moodle 2.1:&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_topmas - Uses the jQuery Masonry plugin to arrange sections as close together as possible.  Resizes automatically depending on content.&lt;br /&gt;
&lt;br /&gt;
===GRID===&lt;br /&gt;
Not strictly a &amp;quot;paged format&amp;quot; But getting very good reviews.  Looks classy.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_grid Seems a good option&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The Grid Format was originally contributed by Paul Krix. It has since been updated and is now maintained ny Pukunui Technology. This format adds a more graphical interface to viewing Moodle topics and also avoids the &amp;quot;scroll of death&amp;quot; issue by using placeholder graphics to represent each topic. When clicked upon, these graphics launch the topics in ajax windows&amp;quot; from https://github.com/moodleman/moodle-courseformat_grid&lt;br /&gt;
&lt;br /&gt;
===COURSE MENU===&lt;br /&gt;
There are at least two in plugins:&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
Plus Lei Zhang (and Awesome Moodle) bar&lt;br /&gt;
&lt;br /&gt;
Catalyst have coded two options included in Moodle in Schools package.&lt;br /&gt;
&lt;br /&gt;
==Section Menu Option==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OU format option==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32509</id>
		<title>Talk:Paged course formats</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32509"/>
		<updated>2012-02-25T22:00:25Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* COLLAPSED */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What is the general idea of &#039;Paged course formats&#039;? - Will it be that you get to see the section name as a list, then if you wish to view it opens in a new tab within the browser?  I now have extensive course format development skills (and I hope enough Git knowledge) - can I help with writing the code for Moodle core?  I&#039;m [http://moodle.org/user/profile.php?id=442195 Gareth J Barnard] - developer of the Collapsed Topics / Weeks course formats.&lt;br /&gt;
&lt;br /&gt;
==Discussions around this==&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=175758#p770737 &lt;br /&gt;
&lt;br /&gt;
==Some of the options currently around for alternative formats==&lt;br /&gt;
Representing several different approaches.&lt;br /&gt;
#http://server3.moodle.com/browse/MDL-28555&lt;br /&gt;
&lt;br /&gt;
===FOLDERVIEW===&lt;br /&gt;
Doed much more than just offer page view.  Eiting magic as well.&lt;br /&gt;
#Folderview Blog post: http://thinkingdistance.org/post/6486856003/folderview-course-format&lt;br /&gt;
#Comments by Michael: http://server3.moodle.com/browse/MDL-27646  Including Folderview in Moodle 2&lt;br /&gt;
&lt;br /&gt;
Paul&#039;s comment: &amp;quot;Paul Chapin added a comment - 07/Jun/11 3:20 AM : The folder view format doesn&#039;t really do it. Basically, that&#039;s just a topic format with a different interface. It doesn&#039;t deal with the situation of the instructor who wants to make a large amount of reference information, usually files and web links, available as part of a topic or week without visually overwhelming the students. By allowing for a hierarchical structuring of material using folders the amount of information the student is presented with at any given time can be limited and organized logically. It&#039;s really files and links that we want, but if that&#039;s implemented, adding the rest of the resource types should be fairly straight forward&amp;quot;  MDL-27646&lt;br /&gt;
&lt;br /&gt;
===FLEXPAGE===&lt;br /&gt;
Unsure of status for 2.&lt;br /&gt;
#Flexipage and Moodle 2.0: http://moodle.org/mod/forum/discuss.php?d=83817#p74318&lt;br /&gt;
&lt;br /&gt;
===COLLAPSED===&lt;br /&gt;
Three forms: Topics, Weeks and Latest First&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_topcoll - Same as Topic&#039;s format but with a &#039;toggle&#039; and a cookie to remember state per user per course that can be persistent.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_weekcoll - Same as Week&#039;s format but with a &#039;toggle&#039; as above.&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_latfirst - Same as above but current week is displayed first and preceding weeks after for the user.  In &#039;editing&#039; mode it is the same as Collapsed Weeks.&lt;br /&gt;
&lt;br /&gt;
Soon all to be combined into one:&lt;br /&gt;
#http://tracker.moodle.org/browse/CONTRIB-3378&lt;br /&gt;
&lt;br /&gt;
===BLOCK===&lt;br /&gt;
Experimental jQuery Masonry (#http://masonry.desandro.com/) format for Moodle 2.1:&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_topmas&lt;br /&gt;
&lt;br /&gt;
===GRID===&lt;br /&gt;
Not strictly a &amp;quot;paged format&amp;quot; But getting very good reviews.  Looks classy.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_grid Seems a good option&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The Grid Format was originally contributed by Paul Krix. It has since been updated and is now maintained ny Pukunui Technology. This format adds a more graphical interface to viewing Moodle topics and also avoids the &amp;quot;scroll of death&amp;quot; issue by using placeholder graphics to represent each topic. When clicked upon, these graphics launch the topics in ajax windows&amp;quot; from https://github.com/moodleman/moodle-courseformat_grid&lt;br /&gt;
&lt;br /&gt;
===COURSE MENU===&lt;br /&gt;
There are at least two in plugins:&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
Plus Lei Zhang (and Awesome Moodle) bar&lt;br /&gt;
&lt;br /&gt;
Catalyst have coded two options included in Moodle in Schools package.&lt;br /&gt;
&lt;br /&gt;
==Section Menu Option==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OU format option==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32508</id>
		<title>Talk:Paged course formats</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32508"/>
		<updated>2012-02-25T21:53:59Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* COLLAPSED */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What is the general idea of &#039;Paged course formats&#039;? - Will it be that you get to see the section name as a list, then if you wish to view it opens in a new tab within the browser?  I now have extensive course format development skills (and I hope enough Git knowledge) - can I help with writing the code for Moodle core?  I&#039;m [http://moodle.org/user/profile.php?id=442195 Gareth J Barnard] - developer of the Collapsed Topics / Weeks course formats.&lt;br /&gt;
&lt;br /&gt;
==Discussions around this==&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=175758#p770737 &lt;br /&gt;
&lt;br /&gt;
==Some of the options currently around for alternative formats==&lt;br /&gt;
Representing several different approaches.&lt;br /&gt;
#http://server3.moodle.com/browse/MDL-28555&lt;br /&gt;
&lt;br /&gt;
===FOLDERVIEW===&lt;br /&gt;
Doed much more than just offer page view.  Eiting magic as well.&lt;br /&gt;
#Folderview Blog post: http://thinkingdistance.org/post/6486856003/folderview-course-format&lt;br /&gt;
#Comments by Michael: http://server3.moodle.com/browse/MDL-27646  Including Folderview in Moodle 2&lt;br /&gt;
&lt;br /&gt;
Paul&#039;s comment: &amp;quot;Paul Chapin added a comment - 07/Jun/11 3:20 AM : The folder view format doesn&#039;t really do it. Basically, that&#039;s just a topic format with a different interface. It doesn&#039;t deal with the situation of the instructor who wants to make a large amount of reference information, usually files and web links, available as part of a topic or week without visually overwhelming the students. By allowing for a hierarchical structuring of material using folders the amount of information the student is presented with at any given time can be limited and organized logically. It&#039;s really files and links that we want, but if that&#039;s implemented, adding the rest of the resource types should be fairly straight forward&amp;quot;  MDL-27646&lt;br /&gt;
&lt;br /&gt;
===FLEXPAGE===&lt;br /&gt;
Unsure of status for 2.&lt;br /&gt;
#Flexipage and Moodle 2.0: http://moodle.org/mod/forum/discuss.php?d=83817#p74318&lt;br /&gt;
&lt;br /&gt;
===COLLAPSED===&lt;br /&gt;
Three forms: Topics, Weeks and Latest First&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_topcoll&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_weekcoll&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_latfirst&lt;br /&gt;
&lt;br /&gt;
Soon all to be combined into one:&lt;br /&gt;
#http://tracker.moodle.org/browse/CONTRIB-3378&lt;br /&gt;
&lt;br /&gt;
===BLOCK===&lt;br /&gt;
Experimental jQuery Masonry (#http://masonry.desandro.com/) format for Moodle 2.1:&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_topmas&lt;br /&gt;
&lt;br /&gt;
===GRID===&lt;br /&gt;
Not strictly a &amp;quot;paged format&amp;quot; But getting very good reviews.  Looks classy.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_grid Seems a good option&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The Grid Format was originally contributed by Paul Krix. It has since been updated and is now maintained ny Pukunui Technology. This format adds a more graphical interface to viewing Moodle topics and also avoids the &amp;quot;scroll of death&amp;quot; issue by using placeholder graphics to represent each topic. When clicked upon, these graphics launch the topics in ajax windows&amp;quot; from https://github.com/moodleman/moodle-courseformat_grid&lt;br /&gt;
&lt;br /&gt;
===COURSE MENU===&lt;br /&gt;
There are at least two in plugins:&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
Plus Lei Zhang (and Awesome Moodle) bar&lt;br /&gt;
&lt;br /&gt;
Catalyst have coded two options included in Moodle in Schools package.&lt;br /&gt;
&lt;br /&gt;
==Section Menu Option==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OU format option==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32507</id>
		<title>Talk:Paged course formats</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32507"/>
		<updated>2012-02-25T21:50:48Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* COLLAPSED */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What is the general idea of &#039;Paged course formats&#039;? - Will it be that you get to see the section name as a list, then if you wish to view it opens in a new tab within the browser?  I now have extensive course format development skills (and I hope enough Git knowledge) - can I help with writing the code for Moodle core?  I&#039;m [http://moodle.org/user/profile.php?id=442195 Gareth J Barnard] - developer of the Collapsed Topics / Weeks course formats.&lt;br /&gt;
&lt;br /&gt;
==Discussions around this==&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=175758#p770737 &lt;br /&gt;
&lt;br /&gt;
==Some of the options currently around for alternative formats==&lt;br /&gt;
Representing several different approaches.&lt;br /&gt;
#http://server3.moodle.com/browse/MDL-28555&lt;br /&gt;
&lt;br /&gt;
===FOLDERVIEW===&lt;br /&gt;
Doed much more than just offer page view.  Eiting magic as well.&lt;br /&gt;
#Folderview Blog post: http://thinkingdistance.org/post/6486856003/folderview-course-format&lt;br /&gt;
#Comments by Michael: http://server3.moodle.com/browse/MDL-27646  Including Folderview in Moodle 2&lt;br /&gt;
&lt;br /&gt;
Paul&#039;s comment: &amp;quot;Paul Chapin added a comment - 07/Jun/11 3:20 AM : The folder view format doesn&#039;t really do it. Basically, that&#039;s just a topic format with a different interface. It doesn&#039;t deal with the situation of the instructor who wants to make a large amount of reference information, usually files and web links, available as part of a topic or week without visually overwhelming the students. By allowing for a hierarchical structuring of material using folders the amount of information the student is presented with at any given time can be limited and organized logically. It&#039;s really files and links that we want, but if that&#039;s implemented, adding the rest of the resource types should be fairly straight forward&amp;quot;  MDL-27646&lt;br /&gt;
&lt;br /&gt;
===FLEXPAGE===&lt;br /&gt;
Unsure of status for 2.&lt;br /&gt;
#Flexipage and Moodle 2.0: http://moodle.org/mod/forum/discuss.php?d=83817#p74318&lt;br /&gt;
&lt;br /&gt;
===COLLAPSED===&lt;br /&gt;
Three forms: Topics, Weeks and Latest First&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_topcoll&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_weekcoll&lt;br /&gt;
#https://github.com/gjb2048/moodle-format_latfirst&lt;br /&gt;
&lt;br /&gt;
Soon all to be combined into one:&lt;br /&gt;
#http://tracker.moodle.org/browse/CONTRIB-3378&lt;br /&gt;
&lt;br /&gt;
===GRID===&lt;br /&gt;
Not strictly a &amp;quot;paged format&amp;quot; But getting very good reviews.  Looks classy.&lt;br /&gt;
#http://moodle.org/plugins/view.php?plugin=format_grid Seems a good option&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The Grid Format was originally contributed by Paul Krix. It has since been updated and is now maintained ny Pukunui Technology. This format adds a more graphical interface to viewing Moodle topics and also avoids the &amp;quot;scroll of death&amp;quot; issue by using placeholder graphics to represent each topic. When clicked upon, these graphics launch the topics in ajax windows&amp;quot; from https://github.com/moodleman/moodle-courseformat_grid&lt;br /&gt;
&lt;br /&gt;
===COURSE MENU===&lt;br /&gt;
There are at least two in plugins:&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
Plus Lei Zhang (and Awesome Moodle) bar&lt;br /&gt;
&lt;br /&gt;
Catalyst have coded two options included in Moodle in Schools package.&lt;br /&gt;
&lt;br /&gt;
==Section Menu Option==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OU format option==&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32321</id>
		<title>Talk:Paged course formats</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Paged_course_formats&amp;diff=32321"/>
		<updated>2012-02-17T22:59:45Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: Created page with &amp;quot;What is the general idea of &amp;#039;Paged course formats&amp;#039;? - Will it be that you get to see the section name as a list, then if you wish to view it opens in a new tab within the browser...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What is the general idea of &#039;Paged course formats&#039;? - Will it be that you get to see the section name as a list, then if you wish to view it opens in a new tab within the browser?  I now have extensive course format development skills (and I hope enough Git knowledge) - can I help with writing the code for Moodle core?  I&#039;m [http://moodle.org/user/profile.php?id=442195 Gareth J Barnard] - developer of the Collapsed Topics / Weeks course formats.&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28386</id>
		<title>Talk:Creating a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28386"/>
		<updated>2010-06-01T08:38:47Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Broken :-( */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wow!  Is the code for this theme available in a file, say in Modules and Plugins?  Or did I miss it in my quick look.  I can see my next project at work. --[[User:chris collman|chris collman]] 12:07, 6 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Hi Chris, the code in this tutorial isn&#039;t available anywhere the reason being that it is entirely based on the base theme :) check out &#039;&#039;theme/base/*&#039;&#039; you&#039;ll notice that what is in there is very close to the code I wrote for this tutorial. --[[User:Sam Hemelryk|Sam Hemelryk]] 01:33, 7 April 2010 (UTC)&lt;br /&gt;
::Hi Sam, I did not look, why get confused by reality and numb about :) I sort of got here by creating a 1.9.8 localhost that I could do screenshots for [[Standard themes]] and then tried my first complete install package of 2.0 in 3 months. My primary goal is to revamp the &#039;navigation&#039; and organization of Category:Themes pages, your instructions are going to help me. Thanks for all your time and efforts.   --[[User:chris collman|chris collman]] 11:26, 7 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Good crisp documentation!! Thank you Sam for this :) You ve made our lives easier with 2.0 themes!! ;) &lt;br /&gt;
&lt;br /&gt;
Cheers!! --[[User:Navin Dutta|Navin Dutta]] 03:12, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Question about instruction==&lt;br /&gt;
Sam, your instructions say there will only be one layout php file called standard.php.  What is the general.php file pointer doing in config.php under base?  If I understand things, it should be pointed to the theme base (which has a general.php) or the file should be called standard.php.  Is that correct?&lt;br /&gt;
&lt;br /&gt;
It is snowing, so I thought I would see if I could follow your instructions and do something like standardlogo in 1.9 for fun.  No doubt will crash and burn with this part time project over the next 2 years :) Thanks --[[User:chris collman|chris collman]] 13:12, 16 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Broken :-( ==&lt;br /&gt;
&lt;br /&gt;
Hello,&lt;br /&gt;
&lt;br /&gt;
Thanks for the tutorial, but with - Moodle 2.0 Preview 2 (Build: 20100531) - I get the error &#039;Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post&#039; when trying to select the theme for modern browsers.&lt;br /&gt;
&lt;br /&gt;
Update: I&#039;ve made the changes required to solve the problem after reading: http://moodle.org/mod/forum/discuss.php?d=150190&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
&lt;br /&gt;
Gareth&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28385</id>
		<title>Talk:Creating a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28385"/>
		<updated>2010-06-01T08:37:58Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Broken :-( */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wow!  Is the code for this theme available in a file, say in Modules and Plugins?  Or did I miss it in my quick look.  I can see my next project at work. --[[User:chris collman|chris collman]] 12:07, 6 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Hi Chris, the code in this tutorial isn&#039;t available anywhere the reason being that it is entirely based on the base theme :) check out &#039;&#039;theme/base/*&#039;&#039; you&#039;ll notice that what is in there is very close to the code I wrote for this tutorial. --[[User:Sam Hemelryk|Sam Hemelryk]] 01:33, 7 April 2010 (UTC)&lt;br /&gt;
::Hi Sam, I did not look, why get confused by reality and numb about :) I sort of got here by creating a 1.9.8 localhost that I could do screenshots for [[Standard themes]] and then tried my first complete install package of 2.0 in 3 months. My primary goal is to revamp the &#039;navigation&#039; and organization of Category:Themes pages, your instructions are going to help me. Thanks for all your time and efforts.   --[[User:chris collman|chris collman]] 11:26, 7 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Good crisp documentation!! Thank you Sam for this :) You ve made our lives easier with 2.0 themes!! ;) &lt;br /&gt;
&lt;br /&gt;
Cheers!! --[[User:Navin Dutta|Navin Dutta]] 03:12, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Question about instruction==&lt;br /&gt;
Sam, your instructions say there will only be one layout php file called standard.php.  What is the general.php file pointer doing in config.php under base?  If I understand things, it should be pointed to the theme base (which has a general.php) or the file should be called standard.php.  Is that correct?&lt;br /&gt;
&lt;br /&gt;
It is snowing, so I thought I would see if I could follow your instructions and do something like standardlogo in 1.9 for fun.  No doubt will crash and burn with this part time project over the next 2 years :) Thanks --[[User:chris collman|chris collman]] 13:12, 16 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Broken :-( ==&lt;br /&gt;
&lt;br /&gt;
Hello,&lt;br /&gt;
&lt;br /&gt;
Thanks for the tutorial, but with - Moodle 2.0 Preview 2 (Build: 20100531) - I get the error &#039;Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post&#039; when trying to select the theme for modern browsers.&lt;br /&gt;
&lt;br /&gt;
Update: I&#039;ve made the changes required to solve the problem after reading: http://moodle.org/mod/forum/discuss.php?d=150190#p657193&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
&lt;br /&gt;
Gareth&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Creating_a_theme&amp;diff=17432</id>
		<title>Creating a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Creating_a_theme&amp;diff=17432"/>
		<updated>2010-06-01T08:36:36Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* The page footer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}{{Moodle 2.0}}This document describes how to create a theme for Moodle 2.0. It assumes you have some understanding of how themes within Moodle work as well as a good understanding of HTML and CSS.&lt;br /&gt;
&lt;br /&gt;
===Theme designer mode===&lt;br /&gt;
&lt;br /&gt;
Under normal operation Moodle does several things in the name of performance, one of these is to combine all of the CSS into one file, minimize it, cache it on the server, and then serve it. After the first request the cached version is served to greatly improve page performance. &lt;br /&gt;
&lt;br /&gt;
What this means for you as a themer? When you make changes they will not be seen immediately. In fact you will need to tell Moodle to rebuild the cache that it is serving.&lt;br /&gt;
This isn&#039;t practical for designing themes of course so the &#039;&#039;&#039;theme designer mode&#039;&#039;&#039; was added. When enabled it tells Moodle not to combine or cache the CSS that gets delivered. This has the downside that page load times will take significantly longer, however you will see your changes immediately every time.&lt;br /&gt;
&lt;br /&gt;
Theme designer mode may be enabled via &#039;&#039;Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; [[Theme settings]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: Internet Explorer versions 6 and 7 have BIG problems when a site attempts to link to more than 31 stylesheets, in which case either a limited number or no styles get applied. Because Moodle sends up all of the CSS all of the time with theme designer mode turned on there is a very high chance you will get more than 31 stylesheets being included. This will of course cause major problems for Internet Explorer until theme designer mode is turned off.&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is create the directories and files you will be using, the first thing to create is the actual directory for your theme. This should be the name of your theme, in my case its &#039;excitement&#039;. The directory should be located within the theme directory of Moodle, ./moodle/theme/excitement/ will be the directory I create.&lt;br /&gt;
&lt;br /&gt;
Now within that directory we can immediately create several files that we know we are going to need. &lt;br /&gt;
&lt;br /&gt;
So the files that we want to create are:&lt;br /&gt;
; config.php :  All of our settings will go here.&lt;br /&gt;
; /style/ : This directory will contain all of our stylesheets.&lt;br /&gt;
; /style/excitement.css : All of our css will go in here.&lt;br /&gt;
; /pix/ : Into this directory we&#039;ll put a screen shot of our theme as well as our favicon and any images we use in CSS.&lt;br /&gt;
; /layout/ : Our layout files will end up in this directory.&lt;br /&gt;
; /layout/standard.php : This will be our one basic layout file.&lt;br /&gt;
&lt;br /&gt;
So after this setup step you should have a directory structure similar to what is shown below.&lt;br /&gt;
&lt;br /&gt;
[[image:Learn_to_theme_01.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Configuring our theme==&lt;br /&gt;
&lt;br /&gt;
Open config.php in your favourite editor and start by adding the opening PHP tags &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;?php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Now we need to add the settings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;excitement&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Very simply this tells Moodle the name of your theme, and if you ever have several config.php files open this will help you identify which one you are looking at.&lt;br /&gt;
&lt;br /&gt;
Next, the parents for this theme.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;parents = array(&#039;base&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This tells Moodle that my new theme &#039;&#039;`excitement`&#039; wants to extend the base theme. &lt;br /&gt;
&lt;br /&gt;
A theme can extend any number of themes. Rather than creating an entirely new theme and copying all of the CSS, you can simply create a new theme, extend the theme you like and just add the changes you want to your theme. &lt;br /&gt;
&lt;br /&gt;
Also worth noting is the purpose of the base theme: it provides us with a basic layout and just enough CSS to make everything fall into place.&lt;br /&gt;
&lt;br /&gt;
Now we will tell Moodle about our stylesheets:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&#039;excitement&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final thing we need to add into our theme&#039;s config.php file is the definition of the layouts for our theme:&lt;br /&gt;
&amp;lt;div style=&amp;quot;height:400px;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;course&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;coursecategory&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;incourse&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;frontpage&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;admin&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;mydashboard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;mypublic&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;login&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;popup&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;frametop&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;maintenance&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
/** List of javascript files that need to be included on each page */&lt;br /&gt;
$THEME-&amp;gt;javascripts = array();&lt;br /&gt;
$THEME-&amp;gt;javascripts_footer = array();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you are looking at is the different layouts for our theme. Why are there so many? Because, that is how many there are in Moodle. There is one for every general type of page. With my &#039;&#039;`excitement`&#039;&#039; theme I have chosen to use my own layout. Unless there was a specific reason to do so, normally you would not need to create your own layouts, you could extend the base theme, and use its layouts, meaning you would only have to write CSS to achieve your desired look.&lt;br /&gt;
&lt;br /&gt;
For each layout above, you will notice the following four things are being set:&lt;br /&gt;
; file : This is the name of the layout file we want to use, it should always be located in the above themes layout directory. For us this is of course standard.php as we only have one layout file.&lt;br /&gt;
; regions : This is an array of block regions that our theme has. Each entry in here can be used to put blocks in when that layout is being used.&lt;br /&gt;
; defaultregion : If a layout has regions it should have a default region, this is where blocks get put when first added.&lt;br /&gt;
; options : These are special settings, anything that gets put into the options array is available later on when we are writing our layout file.&lt;br /&gt;
&lt;br /&gt;
There are additional settings that can be defined in the config.php file - see [[Themes 2.0|Themes 2.0]] for the full list.&lt;br /&gt;
&lt;br /&gt;
==Writing the layout file==&lt;br /&gt;
&lt;br /&gt;
The excitement theme has just one layout file.&lt;br /&gt;
&lt;br /&gt;
The downside of this is that I have to make the layout file do everything I want which means I need to make use of some options (as defined in the layouts in config.php). &lt;br /&gt;
&lt;br /&gt;
The upside is that I only need to maintain one file. &lt;br /&gt;
&lt;br /&gt;
Other than maintenance, using multiple layout files provides many advantages to real world themes in that you can easily tweak and customise specific layouts to achieve the goals of the organisation using the theme.&lt;br /&gt;
&lt;br /&gt;
So lets start writing standard.php, the layout file for my &#039;&#039;`excitement`&#039;&#039; theme.&lt;br /&gt;
&lt;br /&gt;
===The top of the layout file===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hassidepre = $PAGE-&amp;gt;blocks-&amp;gt;region_has_content(&#039;side-pre&#039;, $OUTPUT);&lt;br /&gt;
$hassidepost = $PAGE-&amp;gt;blocks-&amp;gt;region_has_content(&#039;side-post&#039;, $OUTPUT);&lt;br /&gt;
echo $OUTPUT-&amp;gt;doctype(); ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets look at the code that goes into this section:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;doctype(); ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is very important and is required to go at the very top of the page. This tells Moodle to print out the document type tag that is determined by the settings within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we open the HTML tag and then ask Moodle to print the attributes that should go inside it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Simply creates the title tag and asks Moodle to fill it in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are asking Moodle to print all of the other tags and content that need to go into the head. This includes stylesheets, script tags, and inline JavaScript code.&lt;br /&gt;
&lt;br /&gt;
===The page header===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading || (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar())) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;?php if ($PAGE-&amp;gt;heading) { ?&amp;gt;&lt;br /&gt;
            &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
                echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
                if (!empty($PAGE-&amp;gt;layout_options[&#039;langmenu&#039;])) {&lt;br /&gt;
                    echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
                }&lt;br /&gt;
                echo $PAGE-&amp;gt;headingmenu&lt;br /&gt;
            ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
        &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar()) { ?&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So there is a bit more going on here obviously.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Again much like what we did for the opening HTML tag in the head we have started writing the opening body tag and are then asking Moodle to give us the ID we should use for the body tag as well as the classes we should use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This very important call writes some critical bits of JavaScript into the page. It should always be located after the body tag as soon as possible.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading || (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar())) { ?&amp;gt;&lt;br /&gt;
......&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are checking whether or not we need to print the header for the page. There are three checks we need to make here:&lt;br /&gt;
# &#039;&#039;&#039;$PAGE-&amp;gt;heading&#039;&#039;&#039; : This checks to make sure that there is a heading for the page. This will have been set by the script and normally describes the page in a couple of words.&lt;br /&gt;
# &#039;&#039;&#039;empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;])&#039;&#039;&#039; : Now this check is looking at the layout options that we set in our config.php file. It is looking to see if the layout set &#039;nonavbar&#039; =&amp;gt; true.&lt;br /&gt;
# &#039;&#039;&#039;$PAGE-&amp;gt;has_navbar()&#039;&#039;&#039; The third check is to check with the page whether it has a navigation bar to display.&lt;br /&gt;
If either there is a heading for this page or there is a navigation bar to display then we will display a heading.&lt;br /&gt;
&lt;br /&gt;
Leading on from this lets assume that there is a header to print.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
    .....&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This line is simply saying if the page has a heading print it. In this case we run the first check above again just to make sute there is a heading, we then open a heading tag that we choose and ask the page to print the heading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
    echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
    if (!empty($PAGE-&amp;gt;layout_options[&#039;langmenu&#039;])) {&lt;br /&gt;
        echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
    }&lt;br /&gt;
    echo $PAGE-&amp;gt;headingmenu&lt;br /&gt;
?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are looking to print the menu and content that you see at the top of the page (usually to the right). We start by getting Moodle to print the login information for the current user. If the user is logged in this will be their name and a link to their profile, if not then it will be a link to login.&lt;br /&gt;
&lt;br /&gt;
Next we check our page options to see whether a language menu should be printed. If in the layout definition within config.php it sets &#039;&#039;&#039;langmenu =&amp;gt; true&#039;&#039;&#039; then we will print the language menu, a drop down box that lets the user change the language that Moodle displays in.&lt;br /&gt;
&lt;br /&gt;
Finally the page also has a heading menu that can be printed. This heading menu is special HTML that the page you are viewing wants to add. It can be anything from drop down boxes to buttons and any number of each.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar()) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The final part of the header.&lt;br /&gt;
&lt;br /&gt;
Here we want to print the navigation bar for the page if there is one. To find out if there is one we run checks number 2 and 3 again and proceed if they pass.&lt;br /&gt;
&lt;br /&gt;
Assuming there is a header then there are two things that we need to print. The first is the navigation bar. This is a component that the OUTPUT library knows about. The second is a button to shown on the page.&lt;br /&gt;
&lt;br /&gt;
In both cases we can choose to wrap them in a div to make our life as a themer easier.&lt;br /&gt;
&lt;br /&gt;
Well that is it for the header. There is a lot of PHP compared to the other sections of the layout file but it does not change and can be copied and pasted between themes.&lt;br /&gt;
&lt;br /&gt;
===The page content===&lt;br /&gt;
&lt;br /&gt;
I am going with the default two block regions plus the main content.&lt;br /&gt;
&lt;br /&gt;
Because I have based this theme and layout file on the base theme the HTML looks a little intense. This is because it is a floating div layout where the content comes first and then we get the columns (even though one column will be to the left of the content.) Don&#039;t worry too much about it. When it comes to writing your own theme you can go about it as you choose.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;page-content&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;region-main-box&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div id=&amp;quot;region-post-box&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div id=&amp;quot;region-main-wrap&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-main&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;?php if ($hassidepre) { ?&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-pre&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
                &lt;br /&gt;
                &amp;lt;?php if ($hassidepost) { ?&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-post&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In regards to PHP this section is very easy. There are only three lines for the whole section one to get the main content and one for each block region.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This line prints the main content for the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This line gets all of the blocks and more particularly the content for the block region &#039;&#039;&#039;side-pre&#039;&#039;&#039;. This block region will be displayed to the left of the content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are getting the other block region &#039;&#039;&#039;side-post&#039;&#039;&#039; which will be displayed to the right of the content.&lt;br /&gt;
&lt;br /&gt;
===The page footer===&lt;br /&gt;
Here we want to print the footer for the page, any content required by Moodle, and then close the last tags.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;])) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-footer&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The section of code is responsible for printing the footer for the page.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;])) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-footer&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The first thing we do before printing the footer is check that we actually want to print it. This is done by checking the options for the layout as defined in the config.php file. If &#039;&#039;&#039;nofooter =&amp;gt; true&#039;&#039;&#039; is set the we don&#039;t want to print the footer and should skip over this body of code.&lt;br /&gt;
&lt;br /&gt;
Assuming we want to print a footer we proceed to create a div to house its content and then print the bits of the content that will make it up.&lt;br /&gt;
There are four things that the typical page footer will want to print:&lt;br /&gt;
; echo page_doc_link(get_string(&#039;moodledocslink&#039;)) : This will print a link to the Moodle.org help page for this particular page.&lt;br /&gt;
; echo $OUTPUT-&amp;gt;login_info(); : This is the same as at the top of the page and will print the login information for the current user.&lt;br /&gt;
; echo $OUTPUT-&amp;gt;home_link(); : This prints a link back to the Moodle home page for this site.&lt;br /&gt;
; echo $OUTPUT-&amp;gt;standard_footer_html(); : This prints special HTML that is determined by the settings for the site. Things such as performance information or debugging will be printed by this line if they are turned on.&lt;br /&gt;
&lt;br /&gt;
And the final line of code for our layout file is:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html(); ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is one of the most important lines of code in the layout file. It asks Moodle to print any required content into the page, and there will likely be a lot although most of it will not be visual.&lt;br /&gt;
&lt;br /&gt;
It will instead be things such as inline scripts and JavaScript files required to go at the bottom of the page. If you forget this line its likely no JavaScript will work!&lt;br /&gt;
&lt;br /&gt;
We&#039;ve now written our layout file and it is all set to go. The complete source is below for reference. Remember if you want more practical examples simply look at the layout files located within the layout directory of other themes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;height:400px;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hassidepre = $PAGE-&amp;gt;blocks-&amp;gt;region_has_content(&#039;side-pre&#039;, $OUTPUT);&lt;br /&gt;
$hassidepost = $PAGE-&amp;gt;blocks-&amp;gt;region_has_content(&#039;side-post&#039;, $OUTPUT);&lt;br /&gt;
echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title; ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=&amp;quot;shortcut icon&amp;quot; href=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;favicon&#039;, &#039;theme&#039;)?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading || (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar())) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;?php if ($PAGE-&amp;gt;heading) { ?&amp;gt;&lt;br /&gt;
        &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
            echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
            if (!empty($PAGE-&amp;gt;layout_options[&#039;langmenu&#039;])) {&lt;br /&gt;
                echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
            }&lt;br /&gt;
            echo $PAGE-&amp;gt;headingmenu&lt;br /&gt;
        ?&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
        &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar()) { ?&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-content&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div id=&amp;quot;region-main-box&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div id=&amp;quot;region-post-box&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-main-wrap&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div id=&amp;quot;region-main&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                            &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
                        &amp;lt;/div&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;?php if ($hassidepre) { ?&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-pre&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
                &lt;br /&gt;
                &amp;lt;?php if ($hassidepost) { ?&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-post&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;])) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-footer&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Adding some CSS==&lt;br /&gt;
With config.php and standard.php both complete the theme is now usable and starting to look like a real theme, however if you change to it using the theme selector you will notice that it still lacks any style.&lt;br /&gt;
&lt;br /&gt;
This of course is where CSS comes in. When writing code Moodle developers are strongly encouraged to not use inline styles anywhere. This is fantastic for us as themers because there is nothing (or at least very little) in Moodle that cannot be styled using CSS.&lt;br /&gt;
&lt;br /&gt;
===Moodle CSS basics===&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.0 all of the CSS for the whole of Moodle is delivered all of the time! This was done for performance reasons. Moodle now reads in all of the CSS, combines it into one file, shrinks it removing any white space, caches it, and then delivers it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;What this means for you as a themer?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to write good CSS that won&#039;t clash with any other CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
Moodle is so big and complex,there is no way to ensure that classes don&#039;t get reused. What we can control however is the classes and id that get added to the body tag for every page. When writing CSS it is highly encouraged to make full use of these body classes, using them will help ensure the CSS you write has the least chance of causing conflicts.&lt;br /&gt;
&lt;br /&gt;
You should also take the time to look at how the Moodle themes use CSS. Look at their use of the body classes and how they separate the CSS for the theme into separate files based on the region of Moodle it applies to.&lt;br /&gt;
&lt;br /&gt;
Check out [[Themes 2.0|Themes 2.0]] for more information about writing good CSS.&lt;br /&gt;
&lt;br /&gt;
===Starting to write excitement.css===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
a {text-decoration: none;}&lt;br /&gt;
.addcoursebutton .singlebutton {text-align: center;}&lt;br /&gt;
&lt;br /&gt;
h1.headermain {color: #fff;}&lt;br /&gt;
h2.main {border-bottom: 3px solid #013D6A;color: #013D6A;text-align: center;}&lt;br /&gt;
h2.headingblock {font-size: 18pt;margin-top: 0;background-color: #013D6A;color: #FFF;text-align: center;}&lt;br /&gt;
#page-header {background-color: #013D6A;}&lt;br /&gt;
#page-header .headermenu  {color: #FFF;}&lt;br /&gt;
#page-header .headermenu a {color: #FDFF2A;}&lt;br /&gt;
&lt;br /&gt;
.navbar {padding-left: 1em;}&lt;br /&gt;
.breadcrumb li {color: #FFF;}&lt;br /&gt;
.breadcrumb li a {color: #FFF;}&lt;br /&gt;
&lt;br /&gt;
.block {background-color: #013D6A;}&lt;br /&gt;
.block .header .title {color: #FFF;}&lt;br /&gt;
.block .header .title .block_action input {background-color: #FFF;}&lt;br /&gt;
.block .content {border: 1px solid #000;padding: 5px;background-color: #FFF;}&lt;br /&gt;
.block .content .block_tree p {font-size: 80%;}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer {text-align: center;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform {margin-left: 5%;width: 90%;font-size: 9pt;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform #adminsearchquery {width: 95%;}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .calendar-controls a {color: #013D6A;font-weight: bold;}&lt;br /&gt;
.block_calendar_month .content .minicalendar td {border-color: #FFF;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {color: #FFF;background-color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day a {color: #FFF000;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays th {border-width: 0;font-weight: bold;color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays abbr {border-width: 0;text-decoration: none;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
[[image:Learn_to_theme_02.jpg|400px|thumb|Excitement theme screenshot]]&lt;br /&gt;
This isn&#039;t all of the CSS for the theme, but just enough to style the front page when the user is not logged in.&lt;br /&gt;
Remember this theme extends the base theme so there is already CSS for layout as well.&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
* The CSS is laid out in a single line format. This is done within the core themes for Moodle. It makes it quicker to read the selectors and see what is being styled.&lt;br /&gt;
* I have written my selectors to take into account the structure of the HTML (more than just the one tag I want to style). This helps further to reduce the conflicts that I may encounter.&lt;br /&gt;
* I use generic classes like &#039;&#039;.sideblock&#039;&#039; only where I want to be generic, as soon as I want to be specific I use the unique classes such as &#039;&#039;.block_calendar_month&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:right;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Using images within CSS===&lt;br /&gt;
&lt;br /&gt;
I will add two image files to the pix directory of my theme:&lt;br /&gt;
; /theme/excitement/pix/background.png : This will be the background image for my theme.&lt;br /&gt;
; /theme/excitement/pix/gradient.jpg : This will be a gradient I use for the header and headings.&lt;br /&gt;
I quickly created both of these images using gimp and simply saved them to the pix directory.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
html {background-image:url([[pix:theme|background]]);}&lt;br /&gt;
&lt;br /&gt;
h2.headingblock,&lt;br /&gt;
#page-header,&lt;br /&gt;
.sideblock,&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {background-image:url([[pix:theme|gradient]]);background-repeat:repeat-x;background-color: #0273C8;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
[[image:Learn_to_theme_03.jpg‎|400px|thumb|Excitement theme screenshot]]&lt;br /&gt;
The CSS above is the two new rules that I had to write to use my images within CSS.&lt;br /&gt;
&lt;br /&gt;
The first rule sets the background image for the page to background.png&lt;br /&gt;
&lt;br /&gt;
The second rule sets the background for headings, and the sideblocks to use gradient.jpg&lt;br /&gt;
&lt;br /&gt;
You will notice that I did not need to write a path to the image. This is because Moodle has this special syntax that can be used and will be replaced when the CSS is parsed before delivery.&lt;br /&gt;
The advantage of using this syntax over writing the path in is that the path may change depending on where you are or what theme is being used.&lt;br /&gt;
&lt;br /&gt;
Other themers may choose to extend your theme with their own; if you use this syntax then all they need to do to override the image is to create one with the same name in their themes directory.&lt;br /&gt;
&lt;br /&gt;
You will also notice that I don&#039;t need to add the image files extension. This is because Moodle is smart enough to work out what extension the file uses. It also allows themers to override images with different formats.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:right&amp;quot; /&amp;gt;&lt;br /&gt;
The following is the complete CSS for my theme:&lt;br /&gt;
&amp;lt;div style=&amp;quot;overflow:auto;height:400px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
a {text-decoration: none;}&lt;br /&gt;
.addcoursebutton .singlebutton {text-align: center;}&lt;br /&gt;
&lt;br /&gt;
h1.headermain {color: #fff;}&lt;br /&gt;
h2.main {border-bottom: 3px solid #013D6A;color: #013D6A;text-align: center;}&lt;br /&gt;
h2.headingblock {font-size: 18pt;margin-top: 0;background-color: #013D6A;color: #FFF;text-align: center;}&lt;br /&gt;
#page-header {background-color: #013D6A;border-bottom:5px solid #013D6A;}&lt;br /&gt;
#page-header .headermenu  {color: #FFF;}&lt;br /&gt;
#page-header .headermenu a {color: #FDFF2A;}&lt;br /&gt;
&lt;br /&gt;
.sideblock {background-color: #013D6A;}&lt;br /&gt;
.sideblock .header .title {color: #FFF;}&lt;br /&gt;
.sideblock .header .title .block_action input {background-color: #FFF;}&lt;br /&gt;
.sideblock .content {border: 1px solid #000;padding: 5px;background-color: #FFF;}&lt;br /&gt;
.sideblock .content .block_tree p {font-size: 80%;}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer {text-align: center;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform {margin-left: 5%;width: 90%;font-size: 9pt;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform #adminsearchquery {width: 95%;}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .calendar-controls a {color: #013D6A;font-weight: bold;}&lt;br /&gt;
.block_calendar_month .content .minicalendar td {border-color: #FFF;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {color: #FFF;background-color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day a {color: #FFF000;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays th {border-width: 0;font-weight: bold;color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays abbr {border-width: 0;text-decoration: none;}&lt;br /&gt;
&lt;br /&gt;
html {background-image:url([[pix:theme|background]]);}&lt;br /&gt;
&lt;br /&gt;
h2.headingblock,&lt;br /&gt;
#page-header,&lt;br /&gt;
.sideblock,&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {background-image:url([[pix:theme|gradient]]);background-repeat:repeat-x;background-color: #0273C8;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Adding a screenshot and favicon==&lt;br /&gt;
The final thing to do at this point is add both a screenshot for this theme as well as a favicon for it.&lt;br /&gt;
The screenshot will be shown in the theme selector screen and should be named &#039;&#039;screenshot.jpg&#039;&#039;.&lt;br /&gt;
The favicon will be used when someone bookmarks this page.&lt;br /&gt;
Both images should be located in your themes pix directory as follows:&lt;br /&gt;
* /theme/excitement/pix/screenshot.jpg&lt;br /&gt;
* /theme/excitement/pix/favicon.ico&lt;br /&gt;
&lt;br /&gt;
In the case of my theme I have taken a screenshot and added it to that directory, and because I don&#039;t really want to do anything special with the favicon I have copied it from /theme/base/pix/favicon.ico so that at least it will be recognisable as Moodle.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Themes 2.0]]&lt;br /&gt;
* [[Themes 2.0 overriding a renderer]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Themes]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Creating_a_theme&amp;diff=17431</id>
		<title>Creating a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Creating_a_theme&amp;diff=17431"/>
		<updated>2010-06-01T08:34:38Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* The page content */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}{{Moodle 2.0}}This document describes how to create a theme for Moodle 2.0. It assumes you have some understanding of how themes within Moodle work as well as a good understanding of HTML and CSS.&lt;br /&gt;
&lt;br /&gt;
===Theme designer mode===&lt;br /&gt;
&lt;br /&gt;
Under normal operation Moodle does several things in the name of performance, one of these is to combine all of the CSS into one file, minimize it, cache it on the server, and then serve it. After the first request the cached version is served to greatly improve page performance. &lt;br /&gt;
&lt;br /&gt;
What this means for you as a themer? When you make changes they will not be seen immediately. In fact you will need to tell Moodle to rebuild the cache that it is serving.&lt;br /&gt;
This isn&#039;t practical for designing themes of course so the &#039;&#039;&#039;theme designer mode&#039;&#039;&#039; was added. When enabled it tells Moodle not to combine or cache the CSS that gets delivered. This has the downside that page load times will take significantly longer, however you will see your changes immediately every time.&lt;br /&gt;
&lt;br /&gt;
Theme designer mode may be enabled via &#039;&#039;Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; [[Theme settings]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: Internet Explorer versions 6 and 7 have BIG problems when a site attempts to link to more than 31 stylesheets, in which case either a limited number or no styles get applied. Because Moodle sends up all of the CSS all of the time with theme designer mode turned on there is a very high chance you will get more than 31 stylesheets being included. This will of course cause major problems for Internet Explorer until theme designer mode is turned off.&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is create the directories and files you will be using, the first thing to create is the actual directory for your theme. This should be the name of your theme, in my case its &#039;excitement&#039;. The directory should be located within the theme directory of Moodle, ./moodle/theme/excitement/ will be the directory I create.&lt;br /&gt;
&lt;br /&gt;
Now within that directory we can immediately create several files that we know we are going to need. &lt;br /&gt;
&lt;br /&gt;
So the files that we want to create are:&lt;br /&gt;
; config.php :  All of our settings will go here.&lt;br /&gt;
; /style/ : This directory will contain all of our stylesheets.&lt;br /&gt;
; /style/excitement.css : All of our css will go in here.&lt;br /&gt;
; /pix/ : Into this directory we&#039;ll put a screen shot of our theme as well as our favicon and any images we use in CSS.&lt;br /&gt;
; /layout/ : Our layout files will end up in this directory.&lt;br /&gt;
; /layout/standard.php : This will be our one basic layout file.&lt;br /&gt;
&lt;br /&gt;
So after this setup step you should have a directory structure similar to what is shown below.&lt;br /&gt;
&lt;br /&gt;
[[image:Learn_to_theme_01.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Configuring our theme==&lt;br /&gt;
&lt;br /&gt;
Open config.php in your favourite editor and start by adding the opening PHP tags &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;?php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Now we need to add the settings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;excitement&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Very simply this tells Moodle the name of your theme, and if you ever have several config.php files open this will help you identify which one you are looking at.&lt;br /&gt;
&lt;br /&gt;
Next, the parents for this theme.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;parents = array(&#039;base&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This tells Moodle that my new theme &#039;&#039;`excitement`&#039; wants to extend the base theme. &lt;br /&gt;
&lt;br /&gt;
A theme can extend any number of themes. Rather than creating an entirely new theme and copying all of the CSS, you can simply create a new theme, extend the theme you like and just add the changes you want to your theme. &lt;br /&gt;
&lt;br /&gt;
Also worth noting is the purpose of the base theme: it provides us with a basic layout and just enough CSS to make everything fall into place.&lt;br /&gt;
&lt;br /&gt;
Now we will tell Moodle about our stylesheets:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&#039;excitement&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final thing we need to add into our theme&#039;s config.php file is the definition of the layouts for our theme:&lt;br /&gt;
&amp;lt;div style=&amp;quot;height:400px;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;course&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;coursecategory&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;incourse&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;frontpage&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;admin&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;mydashboard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;mypublic&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;login&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;popup&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;frametop&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;maintenance&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
/** List of javascript files that need to be included on each page */&lt;br /&gt;
$THEME-&amp;gt;javascripts = array();&lt;br /&gt;
$THEME-&amp;gt;javascripts_footer = array();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you are looking at is the different layouts for our theme. Why are there so many? Because, that is how many there are in Moodle. There is one for every general type of page. With my &#039;&#039;`excitement`&#039;&#039; theme I have chosen to use my own layout. Unless there was a specific reason to do so, normally you would not need to create your own layouts, you could extend the base theme, and use its layouts, meaning you would only have to write CSS to achieve your desired look.&lt;br /&gt;
&lt;br /&gt;
For each layout above, you will notice the following four things are being set:&lt;br /&gt;
; file : This is the name of the layout file we want to use, it should always be located in the above themes layout directory. For us this is of course standard.php as we only have one layout file.&lt;br /&gt;
; regions : This is an array of block regions that our theme has. Each entry in here can be used to put blocks in when that layout is being used.&lt;br /&gt;
; defaultregion : If a layout has regions it should have a default region, this is where blocks get put when first added.&lt;br /&gt;
; options : These are special settings, anything that gets put into the options array is available later on when we are writing our layout file.&lt;br /&gt;
&lt;br /&gt;
There are additional settings that can be defined in the config.php file - see [[Themes 2.0|Themes 2.0]] for the full list.&lt;br /&gt;
&lt;br /&gt;
==Writing the layout file==&lt;br /&gt;
&lt;br /&gt;
The excitement theme has just one layout file.&lt;br /&gt;
&lt;br /&gt;
The downside of this is that I have to make the layout file do everything I want which means I need to make use of some options (as defined in the layouts in config.php). &lt;br /&gt;
&lt;br /&gt;
The upside is that I only need to maintain one file. &lt;br /&gt;
&lt;br /&gt;
Other than maintenance, using multiple layout files provides many advantages to real world themes in that you can easily tweak and customise specific layouts to achieve the goals of the organisation using the theme.&lt;br /&gt;
&lt;br /&gt;
So lets start writing standard.php, the layout file for my &#039;&#039;`excitement`&#039;&#039; theme.&lt;br /&gt;
&lt;br /&gt;
===The top of the layout file===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hassidepre = $PAGE-&amp;gt;blocks-&amp;gt;region_has_content(&#039;side-pre&#039;, $OUTPUT);&lt;br /&gt;
$hassidepost = $PAGE-&amp;gt;blocks-&amp;gt;region_has_content(&#039;side-post&#039;, $OUTPUT);&lt;br /&gt;
echo $OUTPUT-&amp;gt;doctype(); ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets look at the code that goes into this section:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;doctype(); ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is very important and is required to go at the very top of the page. This tells Moodle to print out the document type tag that is determined by the settings within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we open the HTML tag and then ask Moodle to print the attributes that should go inside it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Simply creates the title tag and asks Moodle to fill it in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are asking Moodle to print all of the other tags and content that need to go into the head. This includes stylesheets, script tags, and inline JavaScript code.&lt;br /&gt;
&lt;br /&gt;
===The page header===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading || (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar())) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;?php if ($PAGE-&amp;gt;heading) { ?&amp;gt;&lt;br /&gt;
            &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
                echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
                if (!empty($PAGE-&amp;gt;layout_options[&#039;langmenu&#039;])) {&lt;br /&gt;
                    echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
                }&lt;br /&gt;
                echo $PAGE-&amp;gt;headingmenu&lt;br /&gt;
            ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
        &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar()) { ?&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So there is a bit more going on here obviously.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Again much like what we did for the opening HTML tag in the head we have started writing the opening body tag and are then asking Moodle to give us the ID we should use for the body tag as well as the classes we should use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This very important call writes some critical bits of JavaScript into the page. It should always be located after the body tag as soon as possible.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading || (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar())) { ?&amp;gt;&lt;br /&gt;
......&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are checking whether or not we need to print the header for the page. There are three checks we need to make here:&lt;br /&gt;
# &#039;&#039;&#039;$PAGE-&amp;gt;heading&#039;&#039;&#039; : This checks to make sure that there is a heading for the page. This will have been set by the script and normally describes the page in a couple of words.&lt;br /&gt;
# &#039;&#039;&#039;empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;])&#039;&#039;&#039; : Now this check is looking at the layout options that we set in our config.php file. It is looking to see if the layout set &#039;nonavbar&#039; =&amp;gt; true.&lt;br /&gt;
# &#039;&#039;&#039;$PAGE-&amp;gt;has_navbar()&#039;&#039;&#039; The third check is to check with the page whether it has a navigation bar to display.&lt;br /&gt;
If either there is a heading for this page or there is a navigation bar to display then we will display a heading.&lt;br /&gt;
&lt;br /&gt;
Leading on from this lets assume that there is a header to print.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
    .....&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This line is simply saying if the page has a heading print it. In this case we run the first check above again just to make sute there is a heading, we then open a heading tag that we choose and ask the page to print the heading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
    echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
    if (!empty($PAGE-&amp;gt;layout_options[&#039;langmenu&#039;])) {&lt;br /&gt;
        echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
    }&lt;br /&gt;
    echo $PAGE-&amp;gt;headingmenu&lt;br /&gt;
?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are looking to print the menu and content that you see at the top of the page (usually to the right). We start by getting Moodle to print the login information for the current user. If the user is logged in this will be their name and a link to their profile, if not then it will be a link to login.&lt;br /&gt;
&lt;br /&gt;
Next we check our page options to see whether a language menu should be printed. If in the layout definition within config.php it sets &#039;&#039;&#039;langmenu =&amp;gt; true&#039;&#039;&#039; then we will print the language menu, a drop down box that lets the user change the language that Moodle displays in.&lt;br /&gt;
&lt;br /&gt;
Finally the page also has a heading menu that can be printed. This heading menu is special HTML that the page you are viewing wants to add. It can be anything from drop down boxes to buttons and any number of each.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar()) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The final part of the header.&lt;br /&gt;
&lt;br /&gt;
Here we want to print the navigation bar for the page if there is one. To find out if there is one we run checks number 2 and 3 again and proceed if they pass.&lt;br /&gt;
&lt;br /&gt;
Assuming there is a header then there are two things that we need to print. The first is the navigation bar. This is a component that the OUTPUT library knows about. The second is a button to shown on the page.&lt;br /&gt;
&lt;br /&gt;
In both cases we can choose to wrap them in a div to make our life as a themer easier.&lt;br /&gt;
&lt;br /&gt;
Well that is it for the header. There is a lot of PHP compared to the other sections of the layout file but it does not change and can be copied and pasted between themes.&lt;br /&gt;
&lt;br /&gt;
===The page content===&lt;br /&gt;
&lt;br /&gt;
I am going with the default two block regions plus the main content.&lt;br /&gt;
&lt;br /&gt;
Because I have based this theme and layout file on the base theme the HTML looks a little intense. This is because it is a floating div layout where the content comes first and then we get the columns (even though one column will be to the left of the content.) Don&#039;t worry too much about it. When it comes to writing your own theme you can go about it as you choose.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;page-content&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;region-main-box&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div id=&amp;quot;region-post-box&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div id=&amp;quot;region-main-wrap&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-main&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;?php if ($hassidepre) { ?&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-pre&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
                &lt;br /&gt;
                &amp;lt;?php if ($hassidepost) { ?&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-post&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In regards to PHP this section is very easy. There are only three lines for the whole section one to get the main content and one for each block region.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This line prints the main content for the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This line gets all of the blocks and more particularly the content for the block region &#039;&#039;&#039;side-pre&#039;&#039;&#039;. This block region will be displayed to the left of the content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are getting the other block region &#039;&#039;&#039;side-post&#039;&#039;&#039; which will be displayed to the right of the content.&lt;br /&gt;
&lt;br /&gt;
===The page footer===&lt;br /&gt;
Here we want to print the footer for the page, any content required by Moodle, and then close the last tags.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;])) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-footer&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The section of code is responsible for printing the footer for the page.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;])) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-footer&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The first thing we do before printing the footer is check that we actually want to print it. This is done by checking the options for the layout as defined in the config.php file. If &#039;&#039;&#039;nofooter =&amp;gt; true&#039;&#039;&#039; is set the we don&#039;t want to print the footer and should skip over this body of code.&lt;br /&gt;
&lt;br /&gt;
Assuming we want to print a footer we proceed to create a div to house its content and then print the bits of the content that will make it up.&lt;br /&gt;
There are four things that the typical page footer will want to print:&lt;br /&gt;
; echo page_doc_link(get_string(&#039;moodledocslink&#039;)) : This will print a link to the Moodle.org help page for this particular page.&lt;br /&gt;
; echo $OUTPUT-&amp;gt;login_info(); : This is the same as at the top of the page and will print the login information for the current user.&lt;br /&gt;
; echo $OUTPUT-&amp;gt;home_link(); : This prints a link back to the Moodle home page for this site.&lt;br /&gt;
; echo $OUTPUT-&amp;gt;standard_footer_html(); : This prints special HTML that is determined by the settings for the site. Things such as performance information or debugging will be printed by this line if they are turned on.&lt;br /&gt;
&lt;br /&gt;
And the final line of code for our layout file is:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html(); ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is one of the most important lines of code in the layout file. It asks Moodle to print any required content into the page, and there will likely be a lot although most of it will not be visual.&lt;br /&gt;
&lt;br /&gt;
It will instead be things such as inline scripts and JavaScript files required to go at the bottom of the page. If you forget this line its likely no JavaScript will work!&lt;br /&gt;
&lt;br /&gt;
We&#039;ve now written our layout file and it is all set to go. The complete source is below for reference. Remember if you want more practical examples simply look at the layout files located within the layout directory of other themes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;height:400px;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title; ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=&amp;quot;shortcut icon&amp;quot; href=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;favicon&#039;, &#039;theme&#039;)?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading || (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar())) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;?php if ($PAGE-&amp;gt;heading) { ?&amp;gt;&lt;br /&gt;
        &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
            echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
            if (!empty($PAGE-&amp;gt;layout_options[&#039;langmenu&#039;])) {&lt;br /&gt;
                echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
            }&lt;br /&gt;
            echo $PAGE-&amp;gt;headingmenu&lt;br /&gt;
        ?&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
        &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar()) { ?&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-content&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div id=&amp;quot;region-main-box&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div id=&amp;quot;region-post-box&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-main-wrap&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div id=&amp;quot;region-main&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                            &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
                        &amp;lt;/div&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-pre&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-post&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;])) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-footer&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Adding some CSS==&lt;br /&gt;
With config.php and standard.php both complete the theme is now usable and starting to look like a real theme, however if you change to it using the theme selector you will notice that it still lacks any style.&lt;br /&gt;
&lt;br /&gt;
This of course is where CSS comes in. When writing code Moodle developers are strongly encouraged to not use inline styles anywhere. This is fantastic for us as themers because there is nothing (or at least very little) in Moodle that cannot be styled using CSS.&lt;br /&gt;
&lt;br /&gt;
===Moodle CSS basics===&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.0 all of the CSS for the whole of Moodle is delivered all of the time! This was done for performance reasons. Moodle now reads in all of the CSS, combines it into one file, shrinks it removing any white space, caches it, and then delivers it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;What this means for you as a themer?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to write good CSS that won&#039;t clash with any other CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
Moodle is so big and complex,there is no way to ensure that classes don&#039;t get reused. What we can control however is the classes and id that get added to the body tag for every page. When writing CSS it is highly encouraged to make full use of these body classes, using them will help ensure the CSS you write has the least chance of causing conflicts.&lt;br /&gt;
&lt;br /&gt;
You should also take the time to look at how the Moodle themes use CSS. Look at their use of the body classes and how they separate the CSS for the theme into separate files based on the region of Moodle it applies to.&lt;br /&gt;
&lt;br /&gt;
Check out [[Themes 2.0|Themes 2.0]] for more information about writing good CSS.&lt;br /&gt;
&lt;br /&gt;
===Starting to write excitement.css===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
a {text-decoration: none;}&lt;br /&gt;
.addcoursebutton .singlebutton {text-align: center;}&lt;br /&gt;
&lt;br /&gt;
h1.headermain {color: #fff;}&lt;br /&gt;
h2.main {border-bottom: 3px solid #013D6A;color: #013D6A;text-align: center;}&lt;br /&gt;
h2.headingblock {font-size: 18pt;margin-top: 0;background-color: #013D6A;color: #FFF;text-align: center;}&lt;br /&gt;
#page-header {background-color: #013D6A;}&lt;br /&gt;
#page-header .headermenu  {color: #FFF;}&lt;br /&gt;
#page-header .headermenu a {color: #FDFF2A;}&lt;br /&gt;
&lt;br /&gt;
.navbar {padding-left: 1em;}&lt;br /&gt;
.breadcrumb li {color: #FFF;}&lt;br /&gt;
.breadcrumb li a {color: #FFF;}&lt;br /&gt;
&lt;br /&gt;
.block {background-color: #013D6A;}&lt;br /&gt;
.block .header .title {color: #FFF;}&lt;br /&gt;
.block .header .title .block_action input {background-color: #FFF;}&lt;br /&gt;
.block .content {border: 1px solid #000;padding: 5px;background-color: #FFF;}&lt;br /&gt;
.block .content .block_tree p {font-size: 80%;}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer {text-align: center;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform {margin-left: 5%;width: 90%;font-size: 9pt;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform #adminsearchquery {width: 95%;}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .calendar-controls a {color: #013D6A;font-weight: bold;}&lt;br /&gt;
.block_calendar_month .content .minicalendar td {border-color: #FFF;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {color: #FFF;background-color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day a {color: #FFF000;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays th {border-width: 0;font-weight: bold;color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays abbr {border-width: 0;text-decoration: none;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
[[image:Learn_to_theme_02.jpg|400px|thumb|Excitement theme screenshot]]&lt;br /&gt;
This isn&#039;t all of the CSS for the theme, but just enough to style the front page when the user is not logged in.&lt;br /&gt;
Remember this theme extends the base theme so there is already CSS for layout as well.&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
* The CSS is laid out in a single line format. This is done within the core themes for Moodle. It makes it quicker to read the selectors and see what is being styled.&lt;br /&gt;
* I have written my selectors to take into account the structure of the HTML (more than just the one tag I want to style). This helps further to reduce the conflicts that I may encounter.&lt;br /&gt;
* I use generic classes like &#039;&#039;.sideblock&#039;&#039; only where I want to be generic, as soon as I want to be specific I use the unique classes such as &#039;&#039;.block_calendar_month&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:right;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Using images within CSS===&lt;br /&gt;
&lt;br /&gt;
I will add two image files to the pix directory of my theme:&lt;br /&gt;
; /theme/excitement/pix/background.png : This will be the background image for my theme.&lt;br /&gt;
; /theme/excitement/pix/gradient.jpg : This will be a gradient I use for the header and headings.&lt;br /&gt;
I quickly created both of these images using gimp and simply saved them to the pix directory.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
html {background-image:url([[pix:theme|background]]);}&lt;br /&gt;
&lt;br /&gt;
h2.headingblock,&lt;br /&gt;
#page-header,&lt;br /&gt;
.sideblock,&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {background-image:url([[pix:theme|gradient]]);background-repeat:repeat-x;background-color: #0273C8;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
[[image:Learn_to_theme_03.jpg‎|400px|thumb|Excitement theme screenshot]]&lt;br /&gt;
The CSS above is the two new rules that I had to write to use my images within CSS.&lt;br /&gt;
&lt;br /&gt;
The first rule sets the background image for the page to background.png&lt;br /&gt;
&lt;br /&gt;
The second rule sets the background for headings, and the sideblocks to use gradient.jpg&lt;br /&gt;
&lt;br /&gt;
You will notice that I did not need to write a path to the image. This is because Moodle has this special syntax that can be used and will be replaced when the CSS is parsed before delivery.&lt;br /&gt;
The advantage of using this syntax over writing the path in is that the path may change depending on where you are or what theme is being used.&lt;br /&gt;
&lt;br /&gt;
Other themers may choose to extend your theme with their own; if you use this syntax then all they need to do to override the image is to create one with the same name in their themes directory.&lt;br /&gt;
&lt;br /&gt;
You will also notice that I don&#039;t need to add the image files extension. This is because Moodle is smart enough to work out what extension the file uses. It also allows themers to override images with different formats.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:right&amp;quot; /&amp;gt;&lt;br /&gt;
The following is the complete CSS for my theme:&lt;br /&gt;
&amp;lt;div style=&amp;quot;overflow:auto;height:400px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
a {text-decoration: none;}&lt;br /&gt;
.addcoursebutton .singlebutton {text-align: center;}&lt;br /&gt;
&lt;br /&gt;
h1.headermain {color: #fff;}&lt;br /&gt;
h2.main {border-bottom: 3px solid #013D6A;color: #013D6A;text-align: center;}&lt;br /&gt;
h2.headingblock {font-size: 18pt;margin-top: 0;background-color: #013D6A;color: #FFF;text-align: center;}&lt;br /&gt;
#page-header {background-color: #013D6A;border-bottom:5px solid #013D6A;}&lt;br /&gt;
#page-header .headermenu  {color: #FFF;}&lt;br /&gt;
#page-header .headermenu a {color: #FDFF2A;}&lt;br /&gt;
&lt;br /&gt;
.sideblock {background-color: #013D6A;}&lt;br /&gt;
.sideblock .header .title {color: #FFF;}&lt;br /&gt;
.sideblock .header .title .block_action input {background-color: #FFF;}&lt;br /&gt;
.sideblock .content {border: 1px solid #000;padding: 5px;background-color: #FFF;}&lt;br /&gt;
.sideblock .content .block_tree p {font-size: 80%;}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer {text-align: center;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform {margin-left: 5%;width: 90%;font-size: 9pt;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform #adminsearchquery {width: 95%;}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .calendar-controls a {color: #013D6A;font-weight: bold;}&lt;br /&gt;
.block_calendar_month .content .minicalendar td {border-color: #FFF;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {color: #FFF;background-color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day a {color: #FFF000;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays th {border-width: 0;font-weight: bold;color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays abbr {border-width: 0;text-decoration: none;}&lt;br /&gt;
&lt;br /&gt;
html {background-image:url([[pix:theme|background]]);}&lt;br /&gt;
&lt;br /&gt;
h2.headingblock,&lt;br /&gt;
#page-header,&lt;br /&gt;
.sideblock,&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {background-image:url([[pix:theme|gradient]]);background-repeat:repeat-x;background-color: #0273C8;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Adding a screenshot and favicon==&lt;br /&gt;
The final thing to do at this point is add both a screenshot for this theme as well as a favicon for it.&lt;br /&gt;
The screenshot will be shown in the theme selector screen and should be named &#039;&#039;screenshot.jpg&#039;&#039;.&lt;br /&gt;
The favicon will be used when someone bookmarks this page.&lt;br /&gt;
Both images should be located in your themes pix directory as follows:&lt;br /&gt;
* /theme/excitement/pix/screenshot.jpg&lt;br /&gt;
* /theme/excitement/pix/favicon.ico&lt;br /&gt;
&lt;br /&gt;
In the case of my theme I have taken a screenshot and added it to that directory, and because I don&#039;t really want to do anything special with the favicon I have copied it from /theme/base/pix/favicon.ico so that at least it will be recognisable as Moodle.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Themes 2.0]]&lt;br /&gt;
* [[Themes 2.0 overriding a renderer]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Themes]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Creating_a_theme&amp;diff=17430</id>
		<title>Creating a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Creating_a_theme&amp;diff=17430"/>
		<updated>2010-06-01T08:33:41Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* The top of the layout file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}{{Moodle 2.0}}This document describes how to create a theme for Moodle 2.0. It assumes you have some understanding of how themes within Moodle work as well as a good understanding of HTML and CSS.&lt;br /&gt;
&lt;br /&gt;
===Theme designer mode===&lt;br /&gt;
&lt;br /&gt;
Under normal operation Moodle does several things in the name of performance, one of these is to combine all of the CSS into one file, minimize it, cache it on the server, and then serve it. After the first request the cached version is served to greatly improve page performance. &lt;br /&gt;
&lt;br /&gt;
What this means for you as a themer? When you make changes they will not be seen immediately. In fact you will need to tell Moodle to rebuild the cache that it is serving.&lt;br /&gt;
This isn&#039;t practical for designing themes of course so the &#039;&#039;&#039;theme designer mode&#039;&#039;&#039; was added. When enabled it tells Moodle not to combine or cache the CSS that gets delivered. This has the downside that page load times will take significantly longer, however you will see your changes immediately every time.&lt;br /&gt;
&lt;br /&gt;
Theme designer mode may be enabled via &#039;&#039;Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; [[Theme settings]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: Internet Explorer versions 6 and 7 have BIG problems when a site attempts to link to more than 31 stylesheets, in which case either a limited number or no styles get applied. Because Moodle sends up all of the CSS all of the time with theme designer mode turned on there is a very high chance you will get more than 31 stylesheets being included. This will of course cause major problems for Internet Explorer until theme designer mode is turned off.&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is create the directories and files you will be using, the first thing to create is the actual directory for your theme. This should be the name of your theme, in my case its &#039;excitement&#039;. The directory should be located within the theme directory of Moodle, ./moodle/theme/excitement/ will be the directory I create.&lt;br /&gt;
&lt;br /&gt;
Now within that directory we can immediately create several files that we know we are going to need. &lt;br /&gt;
&lt;br /&gt;
So the files that we want to create are:&lt;br /&gt;
; config.php :  All of our settings will go here.&lt;br /&gt;
; /style/ : This directory will contain all of our stylesheets.&lt;br /&gt;
; /style/excitement.css : All of our css will go in here.&lt;br /&gt;
; /pix/ : Into this directory we&#039;ll put a screen shot of our theme as well as our favicon and any images we use in CSS.&lt;br /&gt;
; /layout/ : Our layout files will end up in this directory.&lt;br /&gt;
; /layout/standard.php : This will be our one basic layout file.&lt;br /&gt;
&lt;br /&gt;
So after this setup step you should have a directory structure similar to what is shown below.&lt;br /&gt;
&lt;br /&gt;
[[image:Learn_to_theme_01.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Configuring our theme==&lt;br /&gt;
&lt;br /&gt;
Open config.php in your favourite editor and start by adding the opening PHP tags &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;?php&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Now we need to add the settings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;excitement&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Very simply this tells Moodle the name of your theme, and if you ever have several config.php files open this will help you identify which one you are looking at.&lt;br /&gt;
&lt;br /&gt;
Next, the parents for this theme.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;parents = array(&#039;base&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This tells Moodle that my new theme &#039;&#039;`excitement`&#039; wants to extend the base theme. &lt;br /&gt;
&lt;br /&gt;
A theme can extend any number of themes. Rather than creating an entirely new theme and copying all of the CSS, you can simply create a new theme, extend the theme you like and just add the changes you want to your theme. &lt;br /&gt;
&lt;br /&gt;
Also worth noting is the purpose of the base theme: it provides us with a basic layout and just enough CSS to make everything fall into place.&lt;br /&gt;
&lt;br /&gt;
Now we will tell Moodle about our stylesheets:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&#039;excitement&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final thing we need to add into our theme&#039;s config.php file is the definition of the layouts for our theme:&lt;br /&gt;
&amp;lt;div style=&amp;quot;height:400px;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;course&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;coursecategory&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;incourse&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;frontpage&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;admin&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;mydashboard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;mypublic&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;login&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;popup&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;frametop&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;maintenance&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;standard.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
/** List of javascript files that need to be included on each page */&lt;br /&gt;
$THEME-&amp;gt;javascripts = array();&lt;br /&gt;
$THEME-&amp;gt;javascripts_footer = array();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you are looking at is the different layouts for our theme. Why are there so many? Because, that is how many there are in Moodle. There is one for every general type of page. With my &#039;&#039;`excitement`&#039;&#039; theme I have chosen to use my own layout. Unless there was a specific reason to do so, normally you would not need to create your own layouts, you could extend the base theme, and use its layouts, meaning you would only have to write CSS to achieve your desired look.&lt;br /&gt;
&lt;br /&gt;
For each layout above, you will notice the following four things are being set:&lt;br /&gt;
; file : This is the name of the layout file we want to use, it should always be located in the above themes layout directory. For us this is of course standard.php as we only have one layout file.&lt;br /&gt;
; regions : This is an array of block regions that our theme has. Each entry in here can be used to put blocks in when that layout is being used.&lt;br /&gt;
; defaultregion : If a layout has regions it should have a default region, this is where blocks get put when first added.&lt;br /&gt;
; options : These are special settings, anything that gets put into the options array is available later on when we are writing our layout file.&lt;br /&gt;
&lt;br /&gt;
There are additional settings that can be defined in the config.php file - see [[Themes 2.0|Themes 2.0]] for the full list.&lt;br /&gt;
&lt;br /&gt;
==Writing the layout file==&lt;br /&gt;
&lt;br /&gt;
The excitement theme has just one layout file.&lt;br /&gt;
&lt;br /&gt;
The downside of this is that I have to make the layout file do everything I want which means I need to make use of some options (as defined in the layouts in config.php). &lt;br /&gt;
&lt;br /&gt;
The upside is that I only need to maintain one file. &lt;br /&gt;
&lt;br /&gt;
Other than maintenance, using multiple layout files provides many advantages to real world themes in that you can easily tweak and customise specific layouts to achieve the goals of the organisation using the theme.&lt;br /&gt;
&lt;br /&gt;
So lets start writing standard.php, the layout file for my &#039;&#039;`excitement`&#039;&#039; theme.&lt;br /&gt;
&lt;br /&gt;
===The top of the layout file===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hassidepre = $PAGE-&amp;gt;blocks-&amp;gt;region_has_content(&#039;side-pre&#039;, $OUTPUT);&lt;br /&gt;
$hassidepost = $PAGE-&amp;gt;blocks-&amp;gt;region_has_content(&#039;side-post&#039;, $OUTPUT);&lt;br /&gt;
echo $OUTPUT-&amp;gt;doctype(); ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets look at the code that goes into this section:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;doctype(); ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is very important and is required to go at the very top of the page. This tells Moodle to print out the document type tag that is determined by the settings within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we open the HTML tag and then ask Moodle to print the attributes that should go inside it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Simply creates the title tag and asks Moodle to fill it in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are asking Moodle to print all of the other tags and content that need to go into the head. This includes stylesheets, script tags, and inline JavaScript code.&lt;br /&gt;
&lt;br /&gt;
===The page header===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading || (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar())) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;?php if ($PAGE-&amp;gt;heading) { ?&amp;gt;&lt;br /&gt;
            &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
                echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
                if (!empty($PAGE-&amp;gt;layout_options[&#039;langmenu&#039;])) {&lt;br /&gt;
                    echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
                }&lt;br /&gt;
                echo $PAGE-&amp;gt;headingmenu&lt;br /&gt;
            ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
        &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar()) { ?&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So there is a bit more going on here obviously.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Again much like what we did for the opening HTML tag in the head we have started writing the opening body tag and are then asking Moodle to give us the ID we should use for the body tag as well as the classes we should use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This very important call writes some critical bits of JavaScript into the page. It should always be located after the body tag as soon as possible.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading || (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar())) { ?&amp;gt;&lt;br /&gt;
......&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are checking whether or not we need to print the header for the page. There are three checks we need to make here:&lt;br /&gt;
# &#039;&#039;&#039;$PAGE-&amp;gt;heading&#039;&#039;&#039; : This checks to make sure that there is a heading for the page. This will have been set by the script and normally describes the page in a couple of words.&lt;br /&gt;
# &#039;&#039;&#039;empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;])&#039;&#039;&#039; : Now this check is looking at the layout options that we set in our config.php file. It is looking to see if the layout set &#039;nonavbar&#039; =&amp;gt; true.&lt;br /&gt;
# &#039;&#039;&#039;$PAGE-&amp;gt;has_navbar()&#039;&#039;&#039; The third check is to check with the page whether it has a navigation bar to display.&lt;br /&gt;
If either there is a heading for this page or there is a navigation bar to display then we will display a heading.&lt;br /&gt;
&lt;br /&gt;
Leading on from this lets assume that there is a header to print.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
    .....&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This line is simply saying if the page has a heading print it. In this case we run the first check above again just to make sute there is a heading, we then open a heading tag that we choose and ask the page to print the heading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
    echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
    if (!empty($PAGE-&amp;gt;layout_options[&#039;langmenu&#039;])) {&lt;br /&gt;
        echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
    }&lt;br /&gt;
    echo $PAGE-&amp;gt;headingmenu&lt;br /&gt;
?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are looking to print the menu and content that you see at the top of the page (usually to the right). We start by getting Moodle to print the login information for the current user. If the user is logged in this will be their name and a link to their profile, if not then it will be a link to login.&lt;br /&gt;
&lt;br /&gt;
Next we check our page options to see whether a language menu should be printed. If in the layout definition within config.php it sets &#039;&#039;&#039;langmenu =&amp;gt; true&#039;&#039;&#039; then we will print the language menu, a drop down box that lets the user change the language that Moodle displays in.&lt;br /&gt;
&lt;br /&gt;
Finally the page also has a heading menu that can be printed. This heading menu is special HTML that the page you are viewing wants to add. It can be anything from drop down boxes to buttons and any number of each.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar()) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The final part of the header.&lt;br /&gt;
&lt;br /&gt;
Here we want to print the navigation bar for the page if there is one. To find out if there is one we run checks number 2 and 3 again and proceed if they pass.&lt;br /&gt;
&lt;br /&gt;
Assuming there is a header then there are two things that we need to print. The first is the navigation bar. This is a component that the OUTPUT library knows about. The second is a button to shown on the page.&lt;br /&gt;
&lt;br /&gt;
In both cases we can choose to wrap them in a div to make our life as a themer easier.&lt;br /&gt;
&lt;br /&gt;
Well that is it for the header. There is a lot of PHP compared to the other sections of the layout file but it does not change and can be copied and pasted between themes.&lt;br /&gt;
&lt;br /&gt;
===The page content===&lt;br /&gt;
&lt;br /&gt;
I am going with the default two block regions plus the main content.&lt;br /&gt;
&lt;br /&gt;
Because I have based this theme and layout file on the base theme the HTML looks a little intense. This is because it is a floating div layout where the content comes first and then we get the columns (even though one column will be to the left of the content.) Don&#039;t worry too much about it. When it comes to writing your own theme you can go about it as you choose.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;page-content&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;region-main-box&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div id=&amp;quot;region-post-box&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div id=&amp;quot;region-main-wrap&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-main&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div id=&amp;quot;region-pre&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div id=&amp;quot;region-post&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In regards to PHP this section is very easy. There are only three lines for the whole section one to get the main content and one for each block region.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This line prints the main content for the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This line gets all of the blocks and more particularly the content for the block region &#039;&#039;&#039;side-pre&#039;&#039;&#039;. This block region will be displayed to the left of the content.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are getting the other block region &#039;&#039;&#039;side-post&#039;&#039;&#039; which will be displayed to the right of the content.&lt;br /&gt;
&lt;br /&gt;
===The page footer===&lt;br /&gt;
Here we want to print the footer for the page, any content required by Moodle, and then close the last tags.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;])) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-footer&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The section of code is responsible for printing the footer for the page.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
    &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;])) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-footer&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The first thing we do before printing the footer is check that we actually want to print it. This is done by checking the options for the layout as defined in the config.php file. If &#039;&#039;&#039;nofooter =&amp;gt; true&#039;&#039;&#039; is set the we don&#039;t want to print the footer and should skip over this body of code.&lt;br /&gt;
&lt;br /&gt;
Assuming we want to print a footer we proceed to create a div to house its content and then print the bits of the content that will make it up.&lt;br /&gt;
There are four things that the typical page footer will want to print:&lt;br /&gt;
; echo page_doc_link(get_string(&#039;moodledocslink&#039;)) : This will print a link to the Moodle.org help page for this particular page.&lt;br /&gt;
; echo $OUTPUT-&amp;gt;login_info(); : This is the same as at the top of the page and will print the login information for the current user.&lt;br /&gt;
; echo $OUTPUT-&amp;gt;home_link(); : This prints a link back to the Moodle home page for this site.&lt;br /&gt;
; echo $OUTPUT-&amp;gt;standard_footer_html(); : This prints special HTML that is determined by the settings for the site. Things such as performance information or debugging will be printed by this line if they are turned on.&lt;br /&gt;
&lt;br /&gt;
And the final line of code for our layout file is:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html(); ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is one of the most important lines of code in the layout file. It asks Moodle to print any required content into the page, and there will likely be a lot although most of it will not be visual.&lt;br /&gt;
&lt;br /&gt;
It will instead be things such as inline scripts and JavaScript files required to go at the bottom of the page. If you forget this line its likely no JavaScript will work!&lt;br /&gt;
&lt;br /&gt;
We&#039;ve now written our layout file and it is all set to go. The complete source is below for reference. Remember if you want more practical examples simply look at the layout files located within the layout directory of other themes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;height:400px;overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title; ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=&amp;quot;shortcut icon&amp;quot; href=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;favicon&#039;, &#039;theme&#039;)?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($PAGE-&amp;gt;heading || (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar())) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;?php if ($PAGE-&amp;gt;heading) { ?&amp;gt;&lt;br /&gt;
        &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
            echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
            if (!empty($PAGE-&amp;gt;layout_options[&#039;langmenu&#039;])) {&lt;br /&gt;
                echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
            }&lt;br /&gt;
            echo $PAGE-&amp;gt;headingmenu&lt;br /&gt;
        ?&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
        &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar()) { ?&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-content&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div id=&amp;quot;region-main-box&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div id=&amp;quot;region-post-box&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-main-wrap&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div id=&amp;quot;region-main&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                            &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
                        &amp;lt;/div&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-pre&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;div id=&amp;quot;region-post&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&amp;quot;region-content&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;?php if (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;])) { ?&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&amp;quot;page-footer&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
        &amp;lt;?php&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
        ?&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Adding some CSS==&lt;br /&gt;
With config.php and standard.php both complete the theme is now usable and starting to look like a real theme, however if you change to it using the theme selector you will notice that it still lacks any style.&lt;br /&gt;
&lt;br /&gt;
This of course is where CSS comes in. When writing code Moodle developers are strongly encouraged to not use inline styles anywhere. This is fantastic for us as themers because there is nothing (or at least very little) in Moodle that cannot be styled using CSS.&lt;br /&gt;
&lt;br /&gt;
===Moodle CSS basics===&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.0 all of the CSS for the whole of Moodle is delivered all of the time! This was done for performance reasons. Moodle now reads in all of the CSS, combines it into one file, shrinks it removing any white space, caches it, and then delivers it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;What this means for you as a themer?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will need to write good CSS that won&#039;t clash with any other CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
Moodle is so big and complex,there is no way to ensure that classes don&#039;t get reused. What we can control however is the classes and id that get added to the body tag for every page. When writing CSS it is highly encouraged to make full use of these body classes, using them will help ensure the CSS you write has the least chance of causing conflicts.&lt;br /&gt;
&lt;br /&gt;
You should also take the time to look at how the Moodle themes use CSS. Look at their use of the body classes and how they separate the CSS for the theme into separate files based on the region of Moodle it applies to.&lt;br /&gt;
&lt;br /&gt;
Check out [[Themes 2.0|Themes 2.0]] for more information about writing good CSS.&lt;br /&gt;
&lt;br /&gt;
===Starting to write excitement.css===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
a {text-decoration: none;}&lt;br /&gt;
.addcoursebutton .singlebutton {text-align: center;}&lt;br /&gt;
&lt;br /&gt;
h1.headermain {color: #fff;}&lt;br /&gt;
h2.main {border-bottom: 3px solid #013D6A;color: #013D6A;text-align: center;}&lt;br /&gt;
h2.headingblock {font-size: 18pt;margin-top: 0;background-color: #013D6A;color: #FFF;text-align: center;}&lt;br /&gt;
#page-header {background-color: #013D6A;}&lt;br /&gt;
#page-header .headermenu  {color: #FFF;}&lt;br /&gt;
#page-header .headermenu a {color: #FDFF2A;}&lt;br /&gt;
&lt;br /&gt;
.navbar {padding-left: 1em;}&lt;br /&gt;
.breadcrumb li {color: #FFF;}&lt;br /&gt;
.breadcrumb li a {color: #FFF;}&lt;br /&gt;
&lt;br /&gt;
.block {background-color: #013D6A;}&lt;br /&gt;
.block .header .title {color: #FFF;}&lt;br /&gt;
.block .header .title .block_action input {background-color: #FFF;}&lt;br /&gt;
.block .content {border: 1px solid #000;padding: 5px;background-color: #FFF;}&lt;br /&gt;
.block .content .block_tree p {font-size: 80%;}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer {text-align: center;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform {margin-left: 5%;width: 90%;font-size: 9pt;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform #adminsearchquery {width: 95%;}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .calendar-controls a {color: #013D6A;font-weight: bold;}&lt;br /&gt;
.block_calendar_month .content .minicalendar td {border-color: #FFF;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {color: #FFF;background-color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day a {color: #FFF000;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays th {border-width: 0;font-weight: bold;color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays abbr {border-width: 0;text-decoration: none;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
[[image:Learn_to_theme_02.jpg|400px|thumb|Excitement theme screenshot]]&lt;br /&gt;
This isn&#039;t all of the CSS for the theme, but just enough to style the front page when the user is not logged in.&lt;br /&gt;
Remember this theme extends the base theme so there is already CSS for layout as well.&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
* The CSS is laid out in a single line format. This is done within the core themes for Moodle. It makes it quicker to read the selectors and see what is being styled.&lt;br /&gt;
* I have written my selectors to take into account the structure of the HTML (more than just the one tag I want to style). This helps further to reduce the conflicts that I may encounter.&lt;br /&gt;
* I use generic classes like &#039;&#039;.sideblock&#039;&#039; only where I want to be generic, as soon as I want to be specific I use the unique classes such as &#039;&#039;.block_calendar_month&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:right;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Using images within CSS===&lt;br /&gt;
&lt;br /&gt;
I will add two image files to the pix directory of my theme:&lt;br /&gt;
; /theme/excitement/pix/background.png : This will be the background image for my theme.&lt;br /&gt;
; /theme/excitement/pix/gradient.jpg : This will be a gradient I use for the header and headings.&lt;br /&gt;
I quickly created both of these images using gimp and simply saved them to the pix directory.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
html {background-image:url([[pix:theme|background]]);}&lt;br /&gt;
&lt;br /&gt;
h2.headingblock,&lt;br /&gt;
#page-header,&lt;br /&gt;
.sideblock,&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {background-image:url([[pix:theme|gradient]]);background-repeat:repeat-x;background-color: #0273C8;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
[[image:Learn_to_theme_03.jpg‎|400px|thumb|Excitement theme screenshot]]&lt;br /&gt;
The CSS above is the two new rules that I had to write to use my images within CSS.&lt;br /&gt;
&lt;br /&gt;
The first rule sets the background image for the page to background.png&lt;br /&gt;
&lt;br /&gt;
The second rule sets the background for headings, and the sideblocks to use gradient.jpg&lt;br /&gt;
&lt;br /&gt;
You will notice that I did not need to write a path to the image. This is because Moodle has this special syntax that can be used and will be replaced when the CSS is parsed before delivery.&lt;br /&gt;
The advantage of using this syntax over writing the path in is that the path may change depending on where you are or what theme is being used.&lt;br /&gt;
&lt;br /&gt;
Other themers may choose to extend your theme with their own; if you use this syntax then all they need to do to override the image is to create one with the same name in their themes directory.&lt;br /&gt;
&lt;br /&gt;
You will also notice that I don&#039;t need to add the image files extension. This is because Moodle is smart enough to work out what extension the file uses. It also allows themers to override images with different formats.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:right&amp;quot; /&amp;gt;&lt;br /&gt;
The following is the complete CSS for my theme:&lt;br /&gt;
&amp;lt;div style=&amp;quot;overflow:auto;height:400px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
a {text-decoration: none;}&lt;br /&gt;
.addcoursebutton .singlebutton {text-align: center;}&lt;br /&gt;
&lt;br /&gt;
h1.headermain {color: #fff;}&lt;br /&gt;
h2.main {border-bottom: 3px solid #013D6A;color: #013D6A;text-align: center;}&lt;br /&gt;
h2.headingblock {font-size: 18pt;margin-top: 0;background-color: #013D6A;color: #FFF;text-align: center;}&lt;br /&gt;
#page-header {background-color: #013D6A;border-bottom:5px solid #013D6A;}&lt;br /&gt;
#page-header .headermenu  {color: #FFF;}&lt;br /&gt;
#page-header .headermenu a {color: #FDFF2A;}&lt;br /&gt;
&lt;br /&gt;
.sideblock {background-color: #013D6A;}&lt;br /&gt;
.sideblock .header .title {color: #FFF;}&lt;br /&gt;
.sideblock .header .title .block_action input {background-color: #FFF;}&lt;br /&gt;
.sideblock .content {border: 1px solid #000;padding: 5px;background-color: #FFF;}&lt;br /&gt;
.sideblock .content .block_tree p {font-size: 80%;}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer {text-align: center;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform {margin-left: 5%;width: 90%;font-size: 9pt;}&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform #adminsearchquery {width: 95%;}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .calendar-controls a {color: #013D6A;font-weight: bold;}&lt;br /&gt;
.block_calendar_month .content .minicalendar td {border-color: #FFF;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {color: #FFF;background-color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .day a {color: #FFF000;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays th {border-width: 0;font-weight: bold;color: #013D6A;}&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays abbr {border-width: 0;text-decoration: none;}&lt;br /&gt;
&lt;br /&gt;
html {background-image:url([[pix:theme|background]]);}&lt;br /&gt;
&lt;br /&gt;
h2.headingblock,&lt;br /&gt;
#page-header,&lt;br /&gt;
.sideblock,&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {background-image:url([[pix:theme|gradient]]);background-repeat:repeat-x;background-color: #0273C8;}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Adding a screenshot and favicon==&lt;br /&gt;
The final thing to do at this point is add both a screenshot for this theme as well as a favicon for it.&lt;br /&gt;
The screenshot will be shown in the theme selector screen and should be named &#039;&#039;screenshot.jpg&#039;&#039;.&lt;br /&gt;
The favicon will be used when someone bookmarks this page.&lt;br /&gt;
Both images should be located in your themes pix directory as follows:&lt;br /&gt;
* /theme/excitement/pix/screenshot.jpg&lt;br /&gt;
* /theme/excitement/pix/favicon.ico&lt;br /&gt;
&lt;br /&gt;
In the case of my theme I have taken a screenshot and added it to that directory, and because I don&#039;t really want to do anything special with the favicon I have copied it from /theme/base/pix/favicon.ico so that at least it will be recognisable as Moodle.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Themes 2.0]]&lt;br /&gt;
* [[Themes 2.0 overriding a renderer]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Themes]]&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28384</id>
		<title>Talk:Creating a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28384"/>
		<updated>2010-05-31T08:37:43Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Borken :-( */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wow!  Is the code for this theme available in a file, say in Modules and Plugins?  Or did I miss it in my quick look.  I can see my next project at work. --[[User:chris collman|chris collman]] 12:07, 6 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Hi Chris, the code in this tutorial isn&#039;t available anywhere the reason being that it is entirely based on the base theme :) check out &#039;&#039;theme/base/*&#039;&#039; you&#039;ll notice that what is in there is very close to the code I wrote for this tutorial. --[[User:Sam Hemelryk|Sam Hemelryk]] 01:33, 7 April 2010 (UTC)&lt;br /&gt;
::Hi Sam, I did not look, why get confused by reality and numb about :) I sort of got here by creating a 1.9.8 localhost that I could do screenshots for [[Standard themes]] and then tried my first complete install package of 2.0 in 3 months. My primary goal is to revamp the &#039;navigation&#039; and organization of Category:Themes pages, your instructions are going to help me. Thanks for all your time and efforts.   --[[User:chris collman|chris collman]] 11:26, 7 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Good crisp documentation!! Thank you Sam for this :) You ve made our lives easier with 2.0 themes!! ;) &lt;br /&gt;
&lt;br /&gt;
Cheers!! --[[User:Navin Dutta|Navin Dutta]] 03:12, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Question about instruction==&lt;br /&gt;
Sam, your instructions say there will only be one layout php file called standard.php.  What is the general.php file pointer doing in config.php under base?  If I understand things, it should be pointed to the theme base (which has a general.php) or the file should be called standard.php.  Is that correct?&lt;br /&gt;
&lt;br /&gt;
It is snowing, so I thought I would see if I could follow your instructions and do something like standardlogo in 1.9 for fun.  No doubt will crash and burn with this part time project over the next 2 years :) Thanks --[[User:chris collman|chris collman]] 13:12, 16 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Broken :-( ==&lt;br /&gt;
&lt;br /&gt;
Hello,&lt;br /&gt;
&lt;br /&gt;
Thanks for the tutorial, but with - Moodle 2.0 Preview 2 (Build: 20100531) - I get the error &#039;Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post&#039; when trying to select the theme for modern browsers.&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
&lt;br /&gt;
Gareth&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28383</id>
		<title>Talk:Creating a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28383"/>
		<updated>2010-05-31T08:37:31Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Borken :-( */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wow!  Is the code for this theme available in a file, say in Modules and Plugins?  Or did I miss it in my quick look.  I can see my next project at work. --[[User:chris collman|chris collman]] 12:07, 6 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Hi Chris, the code in this tutorial isn&#039;t available anywhere the reason being that it is entirely based on the base theme :) check out &#039;&#039;theme/base/*&#039;&#039; you&#039;ll notice that what is in there is very close to the code I wrote for this tutorial. --[[User:Sam Hemelryk|Sam Hemelryk]] 01:33, 7 April 2010 (UTC)&lt;br /&gt;
::Hi Sam, I did not look, why get confused by reality and numb about :) I sort of got here by creating a 1.9.8 localhost that I could do screenshots for [[Standard themes]] and then tried my first complete install package of 2.0 in 3 months. My primary goal is to revamp the &#039;navigation&#039; and organization of Category:Themes pages, your instructions are going to help me. Thanks for all your time and efforts.   --[[User:chris collman|chris collman]] 11:26, 7 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Good crisp documentation!! Thank you Sam for this :) You ve made our lives easier with 2.0 themes!! ;) &lt;br /&gt;
&lt;br /&gt;
Cheers!! --[[User:Navin Dutta|Navin Dutta]] 03:12, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Question about instruction==&lt;br /&gt;
Sam, your instructions say there will only be one layout php file called standard.php.  What is the general.php file pointer doing in config.php under base?  If I understand things, it should be pointed to the theme base (which has a general.php) or the file should be called standard.php.  Is that correct?&lt;br /&gt;
&lt;br /&gt;
It is snowing, so I thought I would see if I could follow your instructions and do something like standardlogo in 1.9 for fun.  No doubt will crash and burn with this part time project over the next 2 years :) Thanks --[[User:chris collman|chris collman]] 13:12, 16 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Borken :-( ==&lt;br /&gt;
&lt;br /&gt;
Hello,&lt;br /&gt;
&lt;br /&gt;
Thanks for the tutorial, but with - Moodle 2.0 Preview 2 (Build: 20100531) - I get the error &#039;Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post&#039; when trying to select the theme for modern browsers.&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
&lt;br /&gt;
Gareth&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28382</id>
		<title>Talk:Creating a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28382"/>
		<updated>2010-05-31T08:36:40Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Borken :-( */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wow!  Is the code for this theme available in a file, say in Modules and Plugins?  Or did I miss it in my quick look.  I can see my next project at work. --[[User:chris collman|chris collman]] 12:07, 6 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Hi Chris, the code in this tutorial isn&#039;t available anywhere the reason being that it is entirely based on the base theme :) check out &#039;&#039;theme/base/*&#039;&#039; you&#039;ll notice that what is in there is very close to the code I wrote for this tutorial. --[[User:Sam Hemelryk|Sam Hemelryk]] 01:33, 7 April 2010 (UTC)&lt;br /&gt;
::Hi Sam, I did not look, why get confused by reality and numb about :) I sort of got here by creating a 1.9.8 localhost that I could do screenshots for [[Standard themes]] and then tried my first complete install package of 2.0 in 3 months. My primary goal is to revamp the &#039;navigation&#039; and organization of Category:Themes pages, your instructions are going to help me. Thanks for all your time and efforts.   --[[User:chris collman|chris collman]] 11:26, 7 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Good crisp documentation!! Thank you Sam for this :) You ve made our lives easier with 2.0 themes!! ;) &lt;br /&gt;
&lt;br /&gt;
Cheers!! --[[User:Navin Dutta|Navin Dutta]] 03:12, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Question about instruction==&lt;br /&gt;
Sam, your instructions say there will only be one layout php file called standard.php.  What is the general.php file pointer doing in config.php under base?  If I understand things, it should be pointed to the theme base (which has a general.php) or the file should be called standard.php.  Is that correct?&lt;br /&gt;
&lt;br /&gt;
It is snowing, so I thought I would see if I could follow your instructions and do something like standardlogo in 1.9 for fun.  No doubt will crash and burn with this part time project over the next 2 years :) Thanks --[[User:chris collman|chris collman]] 13:12, 16 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Borken :-( ==&lt;br /&gt;
&lt;br /&gt;
Hello,&lt;br /&gt;
&lt;br /&gt;
Thanks for the tutorial, but with - Moodle 2.0 Preview 2 (Build: 20100531) - I get the error &#039;Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post&#039; when tring to select the theme for modern browsers.&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
&lt;br /&gt;
Gareth&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28381</id>
		<title>Talk:Creating a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Talk:Creating_a_theme&amp;diff=28381"/>
		<updated>2010-05-31T08:36:09Z</updated>

		<summary type="html">&lt;p&gt;Gb2048: /* Question about instruction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wow!  Is the code for this theme available in a file, say in Modules and Plugins?  Or did I miss it in my quick look.  I can see my next project at work. --[[User:chris collman|chris collman]] 12:07, 6 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Hi Chris, the code in this tutorial isn&#039;t available anywhere the reason being that it is entirely based on the base theme :) check out &#039;&#039;theme/base/*&#039;&#039; you&#039;ll notice that what is in there is very close to the code I wrote for this tutorial. --[[User:Sam Hemelryk|Sam Hemelryk]] 01:33, 7 April 2010 (UTC)&lt;br /&gt;
::Hi Sam, I did not look, why get confused by reality and numb about :) I sort of got here by creating a 1.9.8 localhost that I could do screenshots for [[Standard themes]] and then tried my first complete install package of 2.0 in 3 months. My primary goal is to revamp the &#039;navigation&#039; and organization of Category:Themes pages, your instructions are going to help me. Thanks for all your time and efforts.   --[[User:chris collman|chris collman]] 11:26, 7 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Good crisp documentation!! Thank you Sam for this :) You ve made our lives easier with 2.0 themes!! ;) &lt;br /&gt;
&lt;br /&gt;
Cheers!! --[[User:Navin Dutta|Navin Dutta]] 03:12, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Question about instruction==&lt;br /&gt;
Sam, your instructions say there will only be one layout php file called standard.php.  What is the general.php file pointer doing in config.php under base?  If I understand things, it should be pointed to the theme base (which has a general.php) or the file should be called standard.php.  Is that correct?&lt;br /&gt;
&lt;br /&gt;
It is snowing, so I thought I would see if I could follow your instructions and do something like standardlogo in 1.9 for fun.  No doubt will crash and burn with this part time project over the next 2 years :) Thanks --[[User:chris collman|chris collman]] 13:12, 16 April 2010 (UTC)&lt;/div&gt;</summary>
		<author><name>Gb2048</name></author>
	</entry>
</feed>