<?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=Ibrahim62</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=Ibrahim62"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Ibrahim62"/>
	<updated>2026-04-17T20:59:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Using_images_in_a_theme&amp;diff=43761</id>
		<title>Using images in a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Using_images_in_a_theme&amp;diff=43761"/>
		<updated>2014-02-10T16:41:17Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: /* Adding new images to your theme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}&lt;br /&gt;
==A little background==&lt;br /&gt;
Moodle 2.0 has introduced a new improved method of making use of images within its pages enabling theme designers to take full control over what images are being used and when possible ensures images are passed through Moodle&#039;s new performance caching system to obtain the best possible performance.&lt;br /&gt;
&lt;br /&gt;
$CFG-&amp;gt;themewww and custom pix in Moodle 1.9 and lower are gone from Moodle 2.0 and have been replaced by this new system.&lt;br /&gt;
&lt;br /&gt;
==Before we start==&lt;br /&gt;
&lt;br /&gt;
# Make sure you have a theme and images to work with, one that you have a backup of just in case.&lt;br /&gt;
# Take note of your theme&#039;s main layout file e.g. &#039;&#039;standard.php&#039;&#039;.&lt;br /&gt;
# Take note of your theme&#039;s main CSS file e.g. &#039;&#039;core.css&#039;&#039;.&lt;br /&gt;
# Turn on &#039;&#039;&#039;Theme designer mode&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
==Image locations within Moodle==&lt;br /&gt;
&lt;br /&gt;
There are three main areas in which images are located - core, plugin and theme.&lt;br /&gt;
&lt;br /&gt;
Core images are used throughout Moodle and are stored in &#039;&#039;moodle/pix&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The pix directory contains the following subdirectories:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;a&#039;&#039; - Icons that are not widely used&lt;br /&gt;
:&#039;&#039;c&#039;&#039; - Calendar-related icons&lt;br /&gt;
:&#039;&#039;f&#039;&#039; - File icons for different file types&lt;br /&gt;
:&#039;&#039;g&#039;&#039; - Default user icons and thumbnails&lt;br /&gt;
:&#039;&#039;i&#039;&#039; - General icons&lt;br /&gt;
:&#039;&#039;m&#039;&#039; - Currency symbols&lt;br /&gt;
:&#039;&#039;s&#039;&#039; - Smileys&lt;br /&gt;
:&#039;&#039;t&#039;&#039; - General icons&lt;br /&gt;
:&#039;&#039;u&#039;&#039; - User icons and thumbnails&lt;br /&gt;
:&#039;&#039;y&#039;&#039; - YUI icons&lt;br /&gt;
&lt;br /&gt;
Plugin images are used by plugins and are stored within the plugin&#039;s directory e.g. &#039;&#039;mod/forum/*&#039;&#039; or &#039;&#039;blocks/navigation/*&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Theme images are used in themes and are stored in the &#039;&#039;pix&#039;&#039; subdirectory of a theme.&lt;br /&gt;
&lt;br /&gt;
==Adding new images to your theme==&lt;br /&gt;
&lt;br /&gt;
To add new images to your theme, such as a background image or a logo, you should start by creating a pix directory within your themes directory.&lt;br /&gt;
&lt;br /&gt;
Lets assume you have two images, gradient.png and logo.jpg. Copy both files to your themes pix directory.&lt;br /&gt;
&lt;br /&gt;
The plan is to use gradient.png as the background image for your theme (in CSS) and use logo.jpg in the header (in your theme&#039;s layout file).&lt;br /&gt;
&lt;br /&gt;
===Using images within CSS===&lt;br /&gt;
&lt;br /&gt;
Moodle parses all CSS files. When theme designer mode is off, Moodle combines them into a handful of large CSS files that get cached and served. At the same time Moodle also looks at the CSS and replaces special syntax rules. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&#039;padding:10px;background-color:#f7f7f7;border:1px dashed #123456&#039;&amp;gt;&amp;lt;nowiki&amp;gt;[[pix:theme|&amp;lt;/nowiki&amp;gt;Ibrahim62.png&amp;lt;span style=&#039;color:#336699;font-weight:bold;&#039;&amp;gt;&amp;lt;nowiki&amp;gt;path/to/image/&amp;lt;/nowiki&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span style=&#039;color:#33993A;font-weight:bold;&#039;&amp;gt;imagename&amp;lt;/span&amp;gt;&amp;lt;nowiki&amp;gt;]]&amp;lt;/nowiki&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above pattern is looked for by Moodle and gets replaced with the correct image URL when found.&lt;br /&gt;
You should note the following things about this pattern when using your own images within CSS:&lt;br /&gt;
&lt;br /&gt;
# The bits in black don&#039;t change&lt;br /&gt;
# The bit in blue is the path to your image within the pix directory. It shouldn&#039;t start with a / but should end with one.&lt;br /&gt;
# The bit in green is the filename (&#039;&#039;&#039;no need to include the file extension&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
To use background.png as the background for our pages, add the following line of CSS to the themes core.css.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
body {background-image:url([[pix:theme|gradient]]);}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we look at how to use your own images within your themes layout files we should first look at how this changes if the image is in a sub directory.&lt;br /&gt;
&lt;br /&gt;
Lets assume gradient.png is located here: &#039;&#039;&#039;pix/myimages/gradients/gradient.png&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CSS would need to be as follows:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
body {background-image:url([[pix:theme|myimages/gradients/gradient]]);}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to refer to an image belonging to a plugin, you can do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
body {background-image:url([[pix:quiz|icon]]);}&lt;br /&gt;
body {background-image:url([[pix:qtype_ddmarker|grid]]);}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That refers to mod/quiz/pix/icon.png/gif and question/type/ddmarker/pix/grid.png/gif respectively (or whatever icons you have put in your theme to override these).&lt;br /&gt;
&lt;br /&gt;
===Using your images within your layout files===&lt;br /&gt;
&lt;br /&gt;
To use logo.jpg within the header of the layout file, open the layout file e.g. general.php and find the correct spot to put your logo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;div id=&amp;quot;page-header&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Logo should go here --&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;
        echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
        echo $PAGE-&amp;gt;headingmenu;&lt;br /&gt;
    ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To achieve this I simply need to add the following line of code:&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;logo&#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;
As before, the image&#039;s file extension is not needed as Moodle finds it automatically.&lt;br /&gt;
&lt;br /&gt;
Combined the solution is very simple:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;div id=&amp;quot;page-header&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;logo&#039;, &#039;theme&#039;); ?&amp;gt;&amp;quot; alt=&amp;quot;&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&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
        echo $PAGE-&amp;gt;headingmenu;&lt;br /&gt;
    ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The only other thing to consider is how this example would look if logo.jpg was located in a subfolder e.g. &#039;&#039;&#039;pix/myimages/logos/logo.jpg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The code for this would be:&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;myimages/logos/logo&#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;
&#039;&#039;&#039;Note that&#039;theme&#039; above means the word theme, and not the name of your theme&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Overriding images in your theme==&lt;br /&gt;
&lt;br /&gt;
Overriding images within your theme can be an important part of creating and/or modifying themes.&lt;br /&gt;
&lt;br /&gt;
As mentioned, there are three main areas for images within Moodle, core, plugins, and themes. Obviously we won&#039;t be overriding theme images as we are in a theme and have full control over that already which just leaves core and plugin images that you may want to override.&lt;br /&gt;
&lt;br /&gt;
Within your theme create the following two directories:&lt;br /&gt;
; /pix_core/ : This is where your images to override core images will need to be.&lt;br /&gt;
; /pix_plugins/ : This is where images to override plugins will need to be.&lt;br /&gt;
&lt;br /&gt;
Next, copy the images that you wish to override into either the pix_core or pix_plugins directory. You need to replicate the directory structure that the images are located in.&lt;br /&gt;
&lt;br /&gt;
The following two examples illustrate how this works for both core and plugin images.&lt;br /&gt;
&lt;br /&gt;
===Overriding core images===&lt;br /&gt;
For this example I am going to override the following two images:&lt;br /&gt;
# &#039;&#039;&#039;moodle/pix/help.gif&#039;&#039;&#039; This image is used for all help image icons and is shown throughout Moodle.&lt;br /&gt;
# &#039;&#039;&#039;moodle/pix/i/info.gif&#039;&#039;&#039; This image is used in several places, most notably the front page if the combo list is being displayed.&lt;br /&gt;
&lt;br /&gt;
So first up help.gif. This is the most basic example of overriding an image. Because the image is directly within Moodle&#039;s pix directory we can simply place our new help image into our themes pix_core directory. There&#039;s nothing more to it!&lt;br /&gt;
&lt;br /&gt;
The second example if not really any more difficult. Because the image is located within the subdirectory &#039;&#039;&#039;i&#039;&#039;&#039; we must create a sub directory within our pix_core directory into which we will copy our new help image. That is, the image ends up at &#039;&#039;&#039;/pix_core/i/info.png&#039;&#039;&#039; inside your theme folder. And again done!&lt;br /&gt;
&lt;br /&gt;
You should also note that, as with any other image in Moodle, the extension doesn&#039;t matter. If you want to replace help.gif with a help.png you can just put the png into the correct directory. As long as the filename is the same Moodle will find it.&lt;br /&gt;
&lt;br /&gt;
===Overriding plugin images===&lt;br /&gt;
This is a little bit more difficult than overriding core images, but not too much so. For this example, let&#039;s say I want to override the following two plugin images:&lt;br /&gt;
# &#039;&#039;&#039;moodle/mod/forum/icon.gif&#039;&#039;&#039; This is the icon that is used everywhere for the forum.&lt;br /&gt;
# &#039;&#039;&#039;moodle/blocks/customblock/activate.png&#039;&#039;&#039; This is an icon in a custom block I have installed.&lt;br /&gt;
&lt;br /&gt;
First up, the forum icon. Just as with core images, we need to put the image in the correct directory structure. In this case it is going to be within our theme&#039;s pix_plugins directory.&lt;br /&gt;
&lt;br /&gt;
Here we need to create the directory structure between &#039;&#039;&#039;/mod/&#039;&#039;&#039; and the image, so we need the following structure &#039;&#039;&#039;/pix_plugins/mod/forum/&#039;&#039;&#039; and into the final forum directory we put our replacement image.&lt;br /&gt;
&lt;br /&gt;
The second example is done in exactly the same way, but with the blocks path. We simply need to put our replacement image in &#039;&#039;&#039;/pix_plugins/blocks/customblock/&#039;&#039;&#039; and it will automatically be overridden.&lt;br /&gt;
&lt;br /&gt;
When looking for an overriding image the following path is used.&lt;br /&gt;
&lt;br /&gt;
# theme (static)&lt;br /&gt;
# themename =&amp;gt; mytheme&lt;br /&gt;
# area =&amp;gt; pix_plugins for plugin images, pix_core for core images, pix for theme images.&lt;br /&gt;
# plugin type =&amp;gt; booktool for the book tool sub plugin for example.&lt;br /&gt;
# plugin name =&amp;gt; print for the name of the sub plugin.&lt;br /&gt;
# file name =&amp;gt; book for the name of the image.&lt;br /&gt;
&lt;br /&gt;
It then searches for the image with the following extensions gif, png, jpg, jpeg in that order.&lt;br /&gt;
&lt;br /&gt;
So you end up with:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
/theme/themename/area/plugintype/pluginname/filename.gif&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example: Silkicons theme==&lt;br /&gt;
As an example of how this all looks when done I have attached a screen shot of a theme I quickly created using the Silk icon set created by Mark James available at [http://famfamfam.com/lab/icons/silk/ http://famfamfam.com/lab/icons/silk/].&lt;br /&gt;
&lt;br /&gt;
[[Image:Silkicon.theme.screenshot.jpg]]&lt;br /&gt;
&lt;br /&gt;
I have also uploaded the this file to this forum discussion if you would like to check it out for yourself.&lt;br /&gt;
[http://moodle.org/mod/forum/discuss.php?d=151581 http://moodle.org/mod/forum/discuss.php?d=151581]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Plugins]]&lt;br /&gt;
* [[Replacing icons with CSS3]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=151581 Using images within your themes (and the silk icon theme)]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=151581#p689883 choosing images based on the users current language]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=157935&amp;amp;parent=691903 how to add a category(categorias) img-bullet]&lt;/div&gt;</summary>
		<author><name>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Using_images_in_a_theme&amp;diff=43754</id>
		<title>Using images in a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Using_images_in_a_theme&amp;diff=43754"/>
		<updated>2014-02-10T16:23:46Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: /* Image locations within Moodle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}&lt;br /&gt;
==A little background==&lt;br /&gt;
Moodle 2.0 has introduced a new improved method of making use of images within its pages enabling theme designers to take full control over what images are being used and when possible ensures images are passed through Moodle&#039;s new performance caching system to obtain the best possible performance.&lt;br /&gt;
&lt;br /&gt;
$CFG-&amp;gt;themewww and custom pix in Moodle 1.9 and lower are gone from Moodle 2.0 and have been replaced by this new system.&lt;br /&gt;
&lt;br /&gt;
==Before we start==&lt;br /&gt;
&lt;br /&gt;
# Make sure you have a theme and images to work with, one that you have a backup of just in case.&lt;br /&gt;
# Take note of your theme&#039;s main layout file e.g. &#039;&#039;standard.php&#039;&#039;.&lt;br /&gt;
# Take note of your theme&#039;s main CSS file e.g. &#039;&#039;core.css&#039;&#039;.&lt;br /&gt;
# Turn on &#039;&#039;&#039;Theme designer mode&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
==Image locations within Moodle==&lt;br /&gt;
[[File:Ibrahim62.jpg]]&lt;br /&gt;
There are three main areas in which images are located - core, plugin and theme.&lt;br /&gt;
&lt;br /&gt;
Core images are used throughout Moodle and are stored in &#039;&#039;moodle/pix&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The pix directory contains the following subdirectories:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;a&#039;&#039; - Icons that are not widely used&lt;br /&gt;
:&#039;&#039;c&#039;&#039; - Calendar-related icons&lt;br /&gt;
:&#039;&#039;f&#039;&#039; - File icons for different file types&lt;br /&gt;
:&#039;&#039;g&#039;&#039; - Default user icons and thumbnails&lt;br /&gt;
:&#039;&#039;i&#039;&#039; - General icons&lt;br /&gt;
:&#039;&#039;m&#039;&#039; - Currency symbols&lt;br /&gt;
:&#039;&#039;s&#039;&#039; - Smileys&amp;lt;nowiki&amp;gt;[[File:Ibrahim62.jpg]]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
:&#039;&#039;t&#039;&#039; - General icons&lt;br /&gt;
:&#039;&#039;u&#039;&#039; - User icons and thumbnails&lt;br /&gt;
:&#039;&#039;y&#039;&#039; - YUI icons&lt;br /&gt;
&lt;br /&gt;
Plugin images are used by plugins and are stored within the plugin&#039;s directory e.g. &#039;&#039;mod/forum/*&#039;&#039; or &#039;&#039;blocks/navigation/*&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Theme images are used in themes and are stored in the &#039;&#039;pix&#039;&#039; subdirectory of a theme.&lt;br /&gt;
&lt;br /&gt;
==Adding new images to your theme==&lt;br /&gt;
&lt;br /&gt;
To add new images to your theme, such as a background image or a logo, you should start by creating a pix directory within your themes directory.&lt;br /&gt;
&lt;br /&gt;
Lets assume you have two images, gradient.png and logo.jpg. Copy both files to your themes pix directory.&lt;br /&gt;
&lt;br /&gt;
The plan is to use gradient.png as the background image for your theme (in CSS) and use logo.jpg in the header (in your theme&#039;s layout file).&lt;br /&gt;
&lt;br /&gt;
===Using images within CSS===&lt;br /&gt;
&lt;br /&gt;
Moodle parses all CSS files. When theme designer mode is off, Moodle combines them into a handful of large CSS files that get cached and served. At the same time Moodle also looks at the CSS and replaces special syntax rules. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&#039;padding:10px;background-color:#f7f7f7;border:1px dashed #123456&#039;&amp;gt;&amp;lt;nowiki&amp;gt;[[pix:theme|&amp;lt;/nowiki&amp;gt;&amp;lt;span style=&#039;color:#336699;font-weight:bold;&#039;&amp;gt;&amp;lt;nowiki&amp;gt;path/to/image/&amp;lt;/nowiki&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span style=&#039;color:#33993A;font-weight:bold;&#039;&amp;gt;imagename&amp;lt;/span&amp;gt;&amp;lt;nowiki&amp;gt;]]&amp;lt;/nowiki&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above pattern is looked for by Moodle and gets replaced with the correct image URL when found.&lt;br /&gt;
You should note the following things about this pattern when using your own images within CSS:&lt;br /&gt;
&lt;br /&gt;
# The bits in black don&#039;t change&lt;br /&gt;
# The bit in blue is the path to your image within the pix directory. It shouldn&#039;t start with a / but should end with one.&lt;br /&gt;
# The bit in green is the filename (&#039;&#039;&#039;no need to include the file extension&#039;&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
To use background.png as the background for our pages, add the following line of CSS to the themes core.css.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
body {background-image:url([[pix:theme|gradient]]);}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we look at how to use your own images within your themes layout files we should first look at how this changes if the image is in a sub directory.&lt;br /&gt;
&lt;br /&gt;
Lets assume gradient.png is located here: &#039;&#039;&#039;pix/myimages/gradients/gradient.png&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CSS would need to be as follows:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
body {background-image:url([[pix:theme|myimages/gradients/gradient]]);}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to refer to an image belonging to a plugin, you can do it like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
body {background-image:url([[pix:quiz|icon]]);}&lt;br /&gt;
body {background-image:url([[pix:qtype_ddmarker|grid]]);}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That refers to mod/quiz/pix/icon.png/gif and question/type/ddmarker/pix/grid.png/gif respectively (or whatever icons you have put in your theme to override these).&lt;br /&gt;
&lt;br /&gt;
===Using your images within your layout files===&lt;br /&gt;
&lt;br /&gt;
To use logo.jpg within the header of the layout file, open the layout file e.g. general.php and find the correct spot to put your logo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;div id=&amp;quot;page-header&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Logo should go here --&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;
        echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
        echo $PAGE-&amp;gt;headingmenu;&lt;br /&gt;
    ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To achieve this I simply need to add the following line of code:&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;logo&#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;
As before, the image&#039;s file extension is not needed as Moodle finds it automatically.&lt;br /&gt;
&lt;br /&gt;
Combined the solution is very simple:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;div id=&amp;quot;page-header&amp;quot; class=&amp;quot;clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;logo&#039;, &#039;theme&#039;); ?&amp;gt;&amp;quot; alt=&amp;quot;&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&lt;br /&gt;
        echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
        echo $OUTPUT-&amp;gt;lang_menu();&lt;br /&gt;
        echo $PAGE-&amp;gt;headingmenu;&lt;br /&gt;
    ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The only other thing to consider is how this example would look if logo.jpg was located in a subfolder e.g. &#039;&#039;&#039;pix/myimages/logos/logo.jpg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The code for this would be:&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;myimages/logos/logo&#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;
&#039;&#039;&#039;Note that&#039;theme&#039; above means the word theme, and not the name of your theme&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Overriding images in your theme==&lt;br /&gt;
&lt;br /&gt;
Overriding images within your theme can be an important part of creating and/or modifying themes.&lt;br /&gt;
&lt;br /&gt;
As mentioned, there are three main areas for images within Moodle, core, plugins, and themes. Obviously we won&#039;t be overriding theme images as we are in a theme and have full control over that already which just leaves core and plugin images that you may want to override.&lt;br /&gt;
&lt;br /&gt;
Within your theme create the following two directories:&lt;br /&gt;
; /pix_core/ : This is where your images to override core images will need to be.&lt;br /&gt;
; /pix_plugins/ : This is where images to override plugins will need to be.&lt;br /&gt;
&lt;br /&gt;
Next, copy the images that you wish to override into either the pix_core or pix_plugins directory. You need to replicate the directory structure that the images are located in.&lt;br /&gt;
&lt;br /&gt;
The following two examples illustrate how this works for both core and plugin images.&lt;br /&gt;
&lt;br /&gt;
===Overriding core images===&lt;br /&gt;
For this example I am going to override the following two images:&lt;br /&gt;
# &#039;&#039;&#039;moodle/pix/help.gif&#039;&#039;&#039; This image is used for all help image icons and is shown throughout Moodle.&lt;br /&gt;
# &#039;&#039;&#039;moodle/pix/i/info.gif&#039;&#039;&#039; This image is used in several places, most notably the front page if the combo list is being displayed.&lt;br /&gt;
&lt;br /&gt;
So first up help.gif. This is the most basic example of overriding an image. Because the image is directly within Moodle&#039;s pix directory we can simply place our new help image into our themes pix_core directory. There&#039;s nothing more to it!&lt;br /&gt;
&lt;br /&gt;
The second example if not really any more difficult. Because the image is located within the subdirectory &#039;&#039;&#039;i&#039;&#039;&#039; we must create a sub directory within our pix_core directory into which we will copy our new help image. That is, the image ends up at &#039;&#039;&#039;/pix_core/i/info.png&#039;&#039;&#039; inside your theme folder. And again done!&lt;br /&gt;
&lt;br /&gt;
You should also note that, as with any other image in Moodle, the extension doesn&#039;t matter. If you want to replace help.gif with a help.png you can just put the png into the correct directory. As long as the filename is the same Moodle will find it.&lt;br /&gt;
&lt;br /&gt;
===Overriding plugin images===&lt;br /&gt;
This is a little bit more difficult than overriding core images, but not too much so. For this example, let&#039;s say I want to override the following two plugin images:&lt;br /&gt;
# &#039;&#039;&#039;moodle/mod/forum/icon.gif&#039;&#039;&#039; This is the icon that is used everywhere for the forum.&lt;br /&gt;
# &#039;&#039;&#039;moodle/blocks/customblock/activate.png&#039;&#039;&#039; This is an icon in a custom block I have installed.&lt;br /&gt;
&lt;br /&gt;
First up, the forum icon. Just as with core images, we need to put the image in the correct directory structure. In this case it is going to be within our theme&#039;s pix_plugins directory.&lt;br /&gt;
&lt;br /&gt;
Here we need to create the directory structure between &#039;&#039;&#039;/mod/&#039;&#039;&#039; and the image, so we need the following structure &#039;&#039;&#039;/pix_plugins/mod/forum/&#039;&#039;&#039; and into the final forum directory we put our replacement image.&lt;br /&gt;
&lt;br /&gt;
The second example is done in exactly the same way, but with the blocks path. We simply need to put our replacement image in &#039;&#039;&#039;/pix_plugins/blocks/customblock/&#039;&#039;&#039; and it will automatically be overridden.&lt;br /&gt;
&lt;br /&gt;
When looking for an overriding image the following path is used.&lt;br /&gt;
&lt;br /&gt;
# theme (static)&lt;br /&gt;
# themename =&amp;gt; mytheme&lt;br /&gt;
# area =&amp;gt; pix_plugins for plugin images, pix_core for core images, pix for theme images.&lt;br /&gt;
# plugin type =&amp;gt; booktool for the book tool sub plugin for example.&lt;br /&gt;
# plugin name =&amp;gt; print for the name of the sub plugin.&lt;br /&gt;
# file name =&amp;gt; book for the name of the image.&lt;br /&gt;
&lt;br /&gt;
It then searches for the image with the following extensions gif, png, jpg, jpeg in that order.&lt;br /&gt;
&lt;br /&gt;
So you end up with:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
/theme/themename/area/plugintype/pluginname/filename.gif&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example: Silkicons theme==&lt;br /&gt;
As an example of how this all looks when done I have attached a screen shot of a theme I quickly created using the Silk icon set created by Mark James available at [http://famfamfam.com/lab/icons/silk/ http://famfamfam.com/lab/icons/silk/].&lt;br /&gt;
&lt;br /&gt;
[[Image:Silkicon.theme.screenshot.jpg]]&lt;br /&gt;
&lt;br /&gt;
I have also uploaded the this file to this forum discussion if you would like to check it out for yourself.&lt;br /&gt;
[http://moodle.org/mod/forum/discuss.php?d=151581 http://moodle.org/mod/forum/discuss.php?d=151581]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Plugins]]&lt;br /&gt;
* [[Replacing icons with CSS3]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=151581 Using images within your themes (and the silk icon theme)]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=151581#p689883 choosing images based on the users current language]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=157935&amp;amp;parent=691903 how to add a category(categorias) img-bullet]&lt;/div&gt;</summary>
		<author><name>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Cloning_a_theme&amp;diff=43753</id>
		<title>Cloning a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Cloning_a_theme&amp;diff=43753"/>
		<updated>2014-02-10T15:54:42Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: /* Recipe for the Impatient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}This document describes how to clone a theme from an existing Moodle 2 theme. It assumes you have some understanding of how themes work within Moodle, as well as a basic understanding of XHTML and CSS. Also, because of the rapid development within Moodle, resulting in a number of versions available namely 2.0.x, 2.1.x 2.2.x 2.3.x 2.4.x and soon to be announced Moodle 2.5.x it is important to know that this tutorial is valid for ONLY Moodle Boxxie theme, and as such does not take into account the various other elements you will find in other Moodle versions of themes like Afterburner, Formal White, Sky High, to name but a few. If you are looking to clone one of these themes then checkout my new tutorials. [https://docs.moodle.org/dev/Themes_2.2_how_to_clone_a_Moodle_2.2_theme How to clone a Moodle 2.2 theme].  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
Since this is a very easy introduction to creating a custom theme, the first thing to create is a copy of the version of the theme you want to clone. For the purpose of this tutorial, we will be cloning &#039;&#039;&#039;Boxxie&#039;&#039;&#039;, which is one of several Moodle &#039;&#039;&#039;core&#039;&#039;&#039; themes. There are other themes you can &#039;clone&#039; which are a little harder to do, but once you are familiar with this easy one, you can tackle the harder ones later.&lt;br /&gt;
&lt;br /&gt;
OK...let&#039;s get started. From your Moodle &#039;&#039;&#039;theme&#039;&#039;&#039; directory &#039;&#039;&#039;right click&#039;&#039;&#039; on &#039;&#039;&#039;boxxie&#039;&#039;&#039; 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 boxxie&#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 let&#039;s rename this folder to &#039;&#039;&#039;foxxie&#039;&#039;&#039; (or to whatever name you want to call your &#039;&#039;&#039;cloned&#039;&#039;&#039; theme).  It is important to use only lower case letters and underscores.&lt;br /&gt;
&lt;br /&gt;
If you open the &#039;&#039;&#039;foxxie&#039;&#039;&#039; directory you will find several directories, sub-directories and files within it. One of these sub-directories &#039;&#039;&#039;&#039;&#039;lang/en/&#039;&#039;&#039;&#039;&#039; contain a file called &#039;&#039;&#039;theme_boxxie.php&#039;&#039;&#039; which will need to be re-named to &#039;&#039;&#039;theme_foxxie.php&#039;&#039;&#039;. But we shall address this later. For now just familiarise yourself with what you find in the &#039;&#039;&#039;foxxie&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
; config.php :  Where all the theme configurations are made.&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_boxxie.php : This file contains all the language strings for your theme.   &lt;br /&gt;
; /layout/ : This directory contains all the layout files for this theme.&lt;br /&gt;
; /layout/frontpage.php : Layout file for front page.&lt;br /&gt;
; /layout/general.php : Layout file for all pages other than the front page.&lt;br /&gt;
; /layout/embedded.php : Layout file for embedded pages.&lt;br /&gt;
; /style/ : This directory contains all the CSS files for this theme.&lt;br /&gt;
; /style/core.css : Contains all the CSS rules for this theme.&lt;br /&gt;
; /style/boilerplate.css : Contains all the &#039;&#039;reset&#039;&#039; CSS rules for this theme.&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;
; /pix/tabs : This contains all the tab images for this 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 theme name, in this case &#039;&#039;&#039;boxxie&#039;&#039;&#039;, occurs. The first place to look is &#039;&#039;&#039;config.php&#039;&#039;&#039;, where you need to change the theme name.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;Communicative-Competence-On-Line&#039;;&lt;br /&gt;
&lt;br /&gt;
////////////////////////////////////////////////////&lt;br /&gt;
// Name of the theme. Most likely the name of&lt;br /&gt;
// the directory in which this file resides.&lt;br /&gt;
////////////////////////////////////////////////////&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The next place to look, as mentioned above, is &#039;&#039;&#039;lang/en/theme_Communicative-Competence-On-Line.php&#039;&#039;&#039;. This file, as well as needing to be renamed, also needs some of its content renaming too. So before we forget, let&#039;s &#039;&#039;&#039;right click&#039;&#039;&#039; on this file and &#039;&#039;&#039;rename&#039;&#039;&#039; it &#039;&#039;&#039;theme_Units.php&#039;&#039;&#039; before we open it.&lt;br /&gt;
&lt;br /&gt;
=== Language Strings ===&lt;br /&gt;
&lt;br /&gt;
When you open &#039;&#039;&#039;theme_Units.php&#039;&#039;&#039; the first thing you will see are the &#039;&#039;&#039;credits&#039;&#039;&#039; for the theme. &lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Strings for component &#039;theme_Communicative-Competence-On-Line&#039;, language &#039;en&#039;, branch &#039;MOODLE_20_STABLE&#039;&lt;br /&gt;
 *&lt;br /&gt;
 * @package   moodlecore&lt;br /&gt;
 * @copyright 2010 Patrick Malley&lt;br /&gt;
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here you will need to change the reference from &#039;&#039;&#039;Communicative-Competence-On-Line&#039;&#039;&#039; to &#039;&#039;&#039;Units&#039;&#039;&#039;, you can leave the rest of this as it is.&lt;br /&gt;
&lt;br /&gt;
The next things you will find in this file are what are known as the &#039;&#039;&#039;language strings&#039;&#039;&#039;. These are used for any customised &#039;&#039;&#039;&#039;&#039;General Objectives&#039;&#039; or &#039;&#039;Behavioural Objectives&#039;&#039;&#039;&#039;&#039; used in a theme. And because this is in the &#039;&#039;&#039;Units/lang/en/&#039;&#039;&#039; directory all the $strings are in English. But if you wanted to add some foreign words and phrases for whenever a user switched languages, you just need to create a new sub-directory in the &#039;&#039;&#039;Units/lang/&#039;&#039;&#039; directory for the language files you need to add there, and then copy and paste this file to that new sub-directory. For example: &#039;&#039;&#039;Units/lang/it/theme_Units.php&#039;&#039;&#039; (where &#039;&#039;&#039;it&#039;&#039;&#039; is the code which represents the Italian language). We will explore the Language aspect of themes in another Moodle Doc. So let&#039;s just concentrate on the changes we need to make to rest of the contents of &#039;&#039;&#039;theme_Units.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Communicative-Competence-On-Line&#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;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the $string section above, the only thing you need to change here is the &#039;&#039;&#039;pluginname&#039;&#039;&#039; from &#039;&#039;&#039;Communicative-Competence-On-Line&#039;&#039;&#039; to &#039;&#039;&#039;foxxie&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In this next section, the &#039;&#039;&#039;choosereadme&#039;&#039;&#039;, which is written in XHTML and is the contents of the page that you will see when selecting &#039;&#039;&#039;Units&#039;&#039;&#039; in the Theme Selector. However, you are advised to read what is actually written there and change it accordingly, renaming &#039;Communicative-Competence-On-Line&#039; to &#039;Units&#039;, and changing the contents of this part to suit yourself. You might not want to keep all that is written here. You could actually condense it, but that&#039;s up to you. Just as long as you give credit, where credit is due, to the original theme designer by stating something on similar lines to what I have written below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;Unitsis a customised Moodle theme&lt;br /&gt;
by Mary Evans based on the original Boxxie theme by Patrick Malley&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open version.php file and change $plugin-&amp;gt;component&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$plugin-&amp;gt;component = &#039;theme_Units&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Recipe for the Impatient==&lt;br /&gt;
For those who want a minimal set of instructions to semi-blindly blast through this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1.&#039;&#039;&#039; Copy &#039;&#039;[moodleroot]/theme/Communicative-Competence-On-Line&#039;&#039; to &#039;&#039;[moodleroot]/theme/Units&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2.&#039;&#039;&#039; Rename &#039;&#039;[moodleroot]/theme/Units/lang/en/theme_Communicative-Competence-On-Line.php&#039;&#039; to &#039;&#039;[moodleroot]/theme/Units/lang/en/theme_Units.php&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3.&#039;&#039;&#039; In &#039;&#039;[moodleroot]/theme/Units/lang/en/theme_Units.php&#039;&#039;, replace any instances of &amp;quot;Communicative-Competence-On-Line&amp;quot; with &amp;quot;Units&amp;quot;, likewise for &amp;quot;Communicative-Competence-On-Line&amp;quot; and &amp;quot;Units&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4.&#039;&#039;&#039; Edit &#039;&#039;[moodleroot]/theme/Units/config.php&#039;&#039; to replace instance(s) of &amp;quot;Communicative-Competence-On-Line&amp;quot; with &amp;quot;Units&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
Please Note: All theme names, directory names, and file names MUST be in lowercase.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Making a horizontal dock]] - Modifying the dock to make it horizontal.&lt;br /&gt;
* [[Styling and customising the dock]] - How to style and customise the dock.&lt;br /&gt;
* [[Adding theme upgrade code]]&lt;br /&gt;
* [[Theme changes in 2.0]]&lt;br /&gt;
* [[jQuery]]&lt;br /&gt;
&lt;br /&gt;
[[es:Clonar un tema]]&lt;/div&gt;</summary>
		<author><name>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Cloning_a_theme&amp;diff=43752</id>
		<title>Cloning a theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Cloning_a_theme&amp;diff=43752"/>
		<updated>2014-02-10T15:49:06Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: /* Renaming Elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}This document describes how to clone a theme from an existing Moodle 2 theme. It assumes you have some understanding of how themes work within Moodle, as well as a basic understanding of XHTML and CSS. Also, because of the rapid development within Moodle, resulting in a number of versions available namely 2.0.x, 2.1.x 2.2.x 2.3.x 2.4.x and soon to be announced Moodle 2.5.x it is important to know that this tutorial is valid for ONLY Moodle Boxxie theme, and as such does not take into account the various other elements you will find in other Moodle versions of themes like Afterburner, Formal White, Sky High, to name but a few. If you are looking to clone one of these themes then checkout my new tutorials. [https://docs.moodle.org/dev/Themes_2.2_how_to_clone_a_Moodle_2.2_theme How to clone a Moodle 2.2 theme].  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
Since this is a very easy introduction to creating a custom theme, the first thing to create is a copy of the version of the theme you want to clone. For the purpose of this tutorial, we will be cloning &#039;&#039;&#039;Boxxie&#039;&#039;&#039;, which is one of several Moodle &#039;&#039;&#039;core&#039;&#039;&#039; themes. There are other themes you can &#039;clone&#039; which are a little harder to do, but once you are familiar with this easy one, you can tackle the harder ones later.&lt;br /&gt;
&lt;br /&gt;
OK...let&#039;s get started. From your Moodle &#039;&#039;&#039;theme&#039;&#039;&#039; directory &#039;&#039;&#039;right click&#039;&#039;&#039; on &#039;&#039;&#039;boxxie&#039;&#039;&#039; 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 boxxie&#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 let&#039;s rename this folder to &#039;&#039;&#039;foxxie&#039;&#039;&#039; (or to whatever name you want to call your &#039;&#039;&#039;cloned&#039;&#039;&#039; theme).  It is important to use only lower case letters and underscores.&lt;br /&gt;
&lt;br /&gt;
If you open the &#039;&#039;&#039;foxxie&#039;&#039;&#039; directory you will find several directories, sub-directories and files within it. One of these sub-directories &#039;&#039;&#039;&#039;&#039;lang/en/&#039;&#039;&#039;&#039;&#039; contain a file called &#039;&#039;&#039;theme_boxxie.php&#039;&#039;&#039; which will need to be re-named to &#039;&#039;&#039;theme_foxxie.php&#039;&#039;&#039;. But we shall address this later. For now just familiarise yourself with what you find in the &#039;&#039;&#039;foxxie&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
These are:&lt;br /&gt;
; config.php :  Where all the theme configurations are made.&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_boxxie.php : This file contains all the language strings for your theme.   &lt;br /&gt;
; /layout/ : This directory contains all the layout files for this theme.&lt;br /&gt;
; /layout/frontpage.php : Layout file for front page.&lt;br /&gt;
; /layout/general.php : Layout file for all pages other than the front page.&lt;br /&gt;
; /layout/embedded.php : Layout file for embedded pages.&lt;br /&gt;
; /style/ : This directory contains all the CSS files for this theme.&lt;br /&gt;
; /style/core.css : Contains all the CSS rules for this theme.&lt;br /&gt;
; /style/boilerplate.css : Contains all the &#039;&#039;reset&#039;&#039; CSS rules for this theme.&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;
; /pix/tabs : This contains all the tab images for this 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 theme name, in this case &#039;&#039;&#039;boxxie&#039;&#039;&#039;, occurs. The first place to look is &#039;&#039;&#039;config.php&#039;&#039;&#039;, where you need to change the theme name.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;Communicative-Competence-On-Line&#039;;&lt;br /&gt;
&lt;br /&gt;
////////////////////////////////////////////////////&lt;br /&gt;
// Name of the theme. Most likely the name of&lt;br /&gt;
// the directory in which this file resides.&lt;br /&gt;
////////////////////////////////////////////////////&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The next place to look, as mentioned above, is &#039;&#039;&#039;lang/en/theme_Communicative-Competence-On-Line.php&#039;&#039;&#039;. This file, as well as needing to be renamed, also needs some of its content renaming too. So before we forget, let&#039;s &#039;&#039;&#039;right click&#039;&#039;&#039; on this file and &#039;&#039;&#039;rename&#039;&#039;&#039; it &#039;&#039;&#039;theme_Units.php&#039;&#039;&#039; before we open it.&lt;br /&gt;
&lt;br /&gt;
=== Language Strings ===&lt;br /&gt;
&lt;br /&gt;
When you open &#039;&#039;&#039;theme_Units.php&#039;&#039;&#039; the first thing you will see are the &#039;&#039;&#039;credits&#039;&#039;&#039; for the theme. &lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Strings for component &#039;theme_Communicative-Competence-On-Line&#039;, language &#039;en&#039;, branch &#039;MOODLE_20_STABLE&#039;&lt;br /&gt;
 *&lt;br /&gt;
 * @package   moodlecore&lt;br /&gt;
 * @copyright 2010 Patrick Malley&lt;br /&gt;
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later&lt;br /&gt;
 */&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here you will need to change the reference from &#039;&#039;&#039;Communicative-Competence-On-Line&#039;&#039;&#039; to &#039;&#039;&#039;Units&#039;&#039;&#039;, you can leave the rest of this as it is.&lt;br /&gt;
&lt;br /&gt;
The next things you will find in this file are what are known as the &#039;&#039;&#039;language strings&#039;&#039;&#039;. These are used for any customised &#039;&#039;&#039;&#039;&#039;General Objectives&#039;&#039; or &#039;&#039;Behavioural Objectives&#039;&#039;&#039;&#039;&#039; used in a theme. And because this is in the &#039;&#039;&#039;Units/lang/en/&#039;&#039;&#039; directory all the $strings are in English. But if you wanted to add some foreign words and phrases for whenever a user switched languages, you just need to create a new sub-directory in the &#039;&#039;&#039;Units/lang/&#039;&#039;&#039; directory for the language files you need to add there, and then copy and paste this file to that new sub-directory. For example: &#039;&#039;&#039;Units/lang/it/theme_Units.php&#039;&#039;&#039; (where &#039;&#039;&#039;it&#039;&#039;&#039; is the code which represents the Italian language). We will explore the Language aspect of themes in another Moodle Doc. So let&#039;s just concentrate on the changes we need to make to rest of the contents of &#039;&#039;&#039;theme_Units.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Communicative-Competence-On-Line&#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;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the $string section above, the only thing you need to change here is the &#039;&#039;&#039;pluginname&#039;&#039;&#039; from &#039;&#039;&#039;Communicative-Competence-On-Line&#039;&#039;&#039; to &#039;&#039;&#039;foxxie&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In this next section, the &#039;&#039;&#039;choosereadme&#039;&#039;&#039;, which is written in XHTML and is the contents of the page that you will see when selecting &#039;&#039;&#039;Units&#039;&#039;&#039; in the Theme Selector. However, you are advised to read what is actually written there and change it accordingly, renaming &#039;Communicative-Competence-On-Line&#039; to &#039;Units&#039;, and changing the contents of this part to suit yourself. You might not want to keep all that is written here. You could actually condense it, but that&#039;s up to you. Just as long as you give credit, where credit is due, to the original theme designer by stating something on similar lines to what I have written below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;Unitsis a customised Moodle theme&lt;br /&gt;
by Mary Evans based on the original Boxxie theme by Patrick Malley&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now open version.php file and change $plugin-&amp;gt;component&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$plugin-&amp;gt;component = &#039;theme_Units&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Recipe for the Impatient==&lt;br /&gt;
For those who want a minimal set of instructions to semi-blindly blast through this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1.&#039;&#039;&#039; Copy &#039;&#039;[moodleroot]/theme/boxxie&#039;&#039; to &#039;&#039;[moodleroot]/theme/foxxie&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2.&#039;&#039;&#039; Rename &#039;&#039;[moodleroot]/theme/foxxie/lang/en/theme_boxxie.php&#039;&#039; to &#039;&#039;[moodleroot]/theme/foxxie/lang/en/theme_foxxie.php&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3.&#039;&#039;&#039; In &#039;&#039;[moodleroot]/theme/foxxie/lang/en/theme_foxxie.php&#039;&#039;, replace any instances of &amp;quot;boxxie&amp;quot; with &amp;quot;foxxie&amp;quot;, likewise for &amp;quot;Boxxie&amp;quot; and &amp;quot;Foxxie&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;4.&#039;&#039;&#039; Edit &#039;&#039;[moodleroot]/theme/foxxie/config.php&#039;&#039; to replace instance(s) of &amp;quot;boxxie&amp;quot; with &amp;quot;foxxie&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
Please Note: All theme names, directory names, and file names MUST be in lowercase.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Making a horizontal dock]] - Modifying the dock to make it horizontal.&lt;br /&gt;
* [[Styling and customising the dock]] - How to style and customise the dock.&lt;br /&gt;
* [[Adding theme upgrade code]]&lt;br /&gt;
* [[Theme changes in 2.0]]&lt;br /&gt;
* [[jQuery]]&lt;br /&gt;
&lt;br /&gt;
[[es:Clonar un tema]]&lt;/div&gt;</summary>
		<author><name>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=43751</id>
		<title>Clean theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=43751"/>
		<updated>2014-02-10T15:37:52Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}{{Moodle 2.5}}This document describes how to copy and customise the Communicative-Competence-On-Line(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+ Communicative-Competence-On-Line theme.&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
From your Moodle &#039;&#039;&#039;Communicative-Competence-On-Line&#039;&#039;&#039; directory &#039;&#039;&#039;right click&#039;&#039;&#039; on the &#039;&#039;&#039;Communicative-Competence-On-Line &#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;Communicative-Competence-On-Line&#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;Communicative-Competence-On-Line&#039;&#039;&#039;. So using the above list as a guide, search through and change all the instances of the theme name &#039;Communicative-Competence-On-Line&#039; to &#039;cleantheme&#039;. This includes the filename of the lang/en/theme_Communicative-Competence-On-Line.php. You need to change this to &#039;theme_Communicative-Competence-On-Linetheme.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 (Communicative-Competence-On-Linetheme) 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 by extending the parent theme renderers, which in this case is bootstrapbase. For example the class that you need to start your renderer with is as follows...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
class theme_yourtheme_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;
...where &#039;&#039;&#039;&#039;Communicative-Competence-On-Line&#039;&#039;&#039;&#039; requires you to change it to your theme name otherwise it will not work.&lt;br /&gt;
&lt;br /&gt;
(Please note: The normal recipe &amp;lt;tt&amp;gt;class theme_&#039;&#039;&#039;Communicative-Competence-On-Line&#039;&#039;&#039;_core_renderer extends core_renderer&amp;lt;/tt&amp;gt; is wrong for themes whose parent theme uses renderers, because this method will ultimately conflict with the parent theme&#039;s renderers.)&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 – Communicative-Competence-On-Line] 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>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=43748</id>
		<title>Clean theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=43748"/>
		<updated>2014-02-10T15:29:23Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}{{Moodle 2.5}}This document describes how to copy and customise the Communicative-Competence-On-Line(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;Communicative-Competence-On-Line&#039;&#039;&#039; directory &#039;&#039;&#039;right click&#039;&#039;&#039; on the &#039;&#039;&#039;Communicative-Competence-On-Line&#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 Communicative-Competence-On-Line&#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;Communicative-Competence-On-Line&#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_Communicative-Competence-On-Line.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 by extending the parent theme renderers, which in this case is bootstrapbase. For example the class that you need to start your renderer with is as follows...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
class theme_Communicative-Competence-On-Line_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;
...where &#039;&#039;&#039;&#039;Communicative-Competence-On-Line&#039;&#039;&#039;&#039; requires you to change it to your theme name otherwise it will not work.&lt;br /&gt;
&lt;br /&gt;
(Please note: The normal recipe &amp;lt;tt&amp;gt;class theme_&#039;&#039;&#039;Communicative-Competence-On-Line&#039;&#039;&#039;_core_renderer extends core_renderer&amp;lt;/tt&amp;gt; is wrong for themes whose parent theme uses renderers, because this method will ultimately conflict with the parent theme&#039;s renderers.)&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>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Creating_a_theme&amp;diff=43747</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=43747"/>
		<updated>2014-02-10T14:55:40Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&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;
; /lang/en/ : The file we put here will make our theme name show properly on the Theme Selector page. You need a few standard entries. Copy the one from the Standard theme and modify is easiest. &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;Communicative Competence on-line&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&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;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&#039;Communicative Competence on-line&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    // Most backwards compatible layout without the blocks - this is the layout used by default&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&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;
    // 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;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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // Main course page&lt;br /&gt;
    &#039;course&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;coursecategory&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // part of course, typical for modules - default page layout if $cm specified in require_login()&lt;br /&gt;
    &#039;incourse&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // The site home page.&lt;br /&gt;
    &#039;frontpage&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;frontpage.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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // Server administration scripts.&lt;br /&gt;
    &#039;admin&#039; =&amp;gt; array(&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;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // My dashboard page&lt;br /&gt;
    &#039;mydashboard&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // My public page&lt;br /&gt;
    &#039;mypublic&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;login&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.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;
&lt;br /&gt;
    // Pages that appear in pop-up windows - no navigation, no blocks, no header.&lt;br /&gt;
    &#039;popup&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.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, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nologininfo&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // No blocks and minimal footer - used for legacy frame layouts only!&lt;br /&gt;
    &#039;frametop&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.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;nocoursefooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // Embeded pages, like iframe/object embeded in moodleform - it needs as much space as possible&lt;br /&gt;
    &#039;embedded&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;embedded.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, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // Used during upgrade and install, and for the &#039;This site is undergoing maintenance&#039; message.&lt;br /&gt;
    // This must not have any blocks, and it is good idea if it does not have links to&lt;br /&gt;
    // other places - for example there should not be a home link in the footer...&lt;br /&gt;
    &#039;maintenance&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;noblocks&#039;=&amp;gt;true, &#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;true, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // Should display the content and basic headers only.&lt;br /&gt;
    &#039;print&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;noblocks&#039;=&amp;gt;true, &#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;false, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // The pagelayout used when a redirection is occuring.&lt;br /&gt;
    &#039;redirect&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;embedded.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, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // The pagelayout used for reports.&lt;br /&gt;
    &#039;report&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;report.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;
    // The pagelayout used for safebrowser and securewindow.&lt;br /&gt;
    &#039;secure&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;true, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nologinlinks&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&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;
&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. It is also where the &amp;quot;add block&amp;quot; block is shown when editing is on.&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;
==Configuring the language file==&lt;br /&gt;
Open theme_base.php file from &#039;&#039;&#039;base/lang/en/theme_base.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Save it as &#039;&#039;&#039;Communicative Competence on-line/lang/en/theme_Communicative Competence on-line.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Change &lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Base&#039;; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
to&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Communicative Competence on-line&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After making these changes and perhaps clearing theme caches and/or purging all caches, the new theme name should now show properly in the Theme Selector: &#039;&#039;Site Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme Selector&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can also edit the theme description:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;Write your theme description here.&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to leave the following two lines in place (you can change the wording if you need to) to avoid notices when editing blocks etc.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&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;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Writing the layout file==&lt;br /&gt;
&lt;br /&gt;
The Communicative Competence on-line 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;
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;
So lets start writing standard.php, the layout file for my &#039;&#039;`Communicative Competence on-line`&#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;Communicative Competence on-line&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;Communicative Competence on-line&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 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;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;Communicative Competence on-line&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;Communicative Competence on-line&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;Units&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;Units&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 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;
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;Communicative Competence on-line&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 sure 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;Communicative Competence on-line&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; Communicative Competence on-line&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 show on the page.&lt;br /&gt;
&lt;br /&gt;
In both cases we choose to wrap them in a div tag with a class attribute to enable theming on those elements.&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;
PLEASE NOTE: In Moodle 2.2 onwards &amp;quot;core_renderer::MAIN_CONTENT_TOKEN&amp;quot; changed to &amp;quot;$OUTPUT-&amp;gt;main_content()&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($hassidepre) { ?&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
These lines of code check the variables we created earlier on to decide whether we should show the pre block region. If you try to display a block region that isn&#039;t there or has no content then Moodle will give you an error message so these lines are very important.&lt;br /&gt;
&lt;br /&gt;
For those who get an error message if it is &amp;quot;unknown block region side-pre&amp;quot; or &amp;quot;unknown block region side-post&amp;quot; then this is the issue you are experiencing. Simply add the following lines and all will be fine.&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 if ($hassidepost) { ?&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Again we should make this check for every block region as there are some pages that have no blocks what-so-ever.&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;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;Communicative Competence on-line&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 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;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;Communicative Competence on-line&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;Communicative Competence on-line&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;Communicative Competence on-line&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; Communicative Competence on-line&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;
&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]] and [[CSS coding style]] for more information about writing good CSS.&lt;br /&gt;
&lt;br /&gt;
===Starting to write Communicative Competence On-Line.css===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
a {&lt;br /&gt;
    text-decoration: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.addcoursebutton .singlebutton {&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
h1.headermain {&lt;br /&gt;
    color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
h2.main {&lt;br /&gt;
    border-bottom: 3px solid #013D6A;&lt;br /&gt;
    color: #013D6A;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
h2.headingblock {&lt;br /&gt;
    font-size: 18pt;&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#page-header {&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#page-header .headermenu {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#page-header .headermenu a {&lt;br /&gt;
    color: #FDFF2A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbar {&lt;br /&gt;
    padding-left: 1em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.breadcrumb li {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.breadcrumb li a {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block {&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .header .title {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .header .title .block_action input {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .content {&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .content .block_tree p {&lt;br /&gt;
    font-size: 80%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer {&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform {&lt;br /&gt;
    margin-left: 5%;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
    font-size: 9pt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform #adminsearchquery {&lt;br /&gt;
    width: 95%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .calendar-controls a {&lt;br /&gt;
    color: #013D6A;&lt;br /&gt;
    font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar td {&lt;br /&gt;
    border-color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .day a {&lt;br /&gt;
    color: #FFF000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays th {&lt;br /&gt;
    border-width: 0;&lt;br /&gt;
    font-weight: bold;&lt;br /&gt;
    color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays abbr {&lt;br /&gt;
    border-width: 0;&lt;br /&gt;
    text-decoration: none;&lt;br /&gt;
}&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/Communicative Competence On-Line/pix/background.png : This will be the background image for my theme.&lt;br /&gt;
; /theme/Communicative Competence On-Line/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 {&lt;br /&gt;
    background-image: url([[pix:theme|background]]);&lt;br /&gt;
}&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 {&lt;br /&gt;
    background-image: url([[pix:theme|gradient]]);&lt;br /&gt;
    background-repeat: repeat-x;&lt;br /&gt;
    background-color: #0273C8;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
[[image:Learn_to_theme_03.jpg‎|400px|thumb|Communicative Competence On-Linetheme 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:860px;&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]]);&lt;br /&gt;
   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/Communicative Competence On-Line/pix/screenshot.jpg&lt;br /&gt;
* /theme/Communicative Competence On-Line/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;
[[es:Desarollo:Temas 2.0 creando tu primer tema]]&lt;/div&gt;</summary>
		<author><name>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Creating_a_theme&amp;diff=43746</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=43746"/>
		<updated>2014-02-10T14:42:09Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&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;
; /lang/en/ : The file we put here will make our theme name show properly on the Theme Selector page. You need a few standard entries. Copy the one from the Standard theme and modify is easiest. &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;Communicative Competence on-line&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&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;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&#039;Communicative Competence on-line&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    // Most backwards compatible layout without the blocks - this is the layout used by default&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&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;
    // 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;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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // Main course page&lt;br /&gt;
    &#039;course&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;coursecategory&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // part of course, typical for modules - default page layout if $cm specified in require_login()&lt;br /&gt;
    &#039;incourse&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // The site home page.&lt;br /&gt;
    &#039;frontpage&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;frontpage.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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // Server administration scripts.&lt;br /&gt;
    &#039;admin&#039; =&amp;gt; array(&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;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // My dashboard page&lt;br /&gt;
    &#039;mydashboard&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // My public page&lt;br /&gt;
    &#039;mypublic&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;login&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.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;
&lt;br /&gt;
    // Pages that appear in pop-up windows - no navigation, no blocks, no header.&lt;br /&gt;
    &#039;popup&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.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, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nologininfo&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // No blocks and minimal footer - used for legacy frame layouts only!&lt;br /&gt;
    &#039;frametop&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.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;nocoursefooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // Embeded pages, like iframe/object embeded in moodleform - it needs as much space as possible&lt;br /&gt;
    &#039;embedded&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;embedded.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, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // Used during upgrade and install, and for the &#039;This site is undergoing maintenance&#039; message.&lt;br /&gt;
    // This must not have any blocks, and it is good idea if it does not have links to&lt;br /&gt;
    // other places - for example there should not be a home link in the footer...&lt;br /&gt;
    &#039;maintenance&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;noblocks&#039;=&amp;gt;true, &#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;true, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // Should display the content and basic headers only.&lt;br /&gt;
    &#039;print&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;noblocks&#039;=&amp;gt;true, &#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;false, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // The pagelayout used when a redirection is occuring.&lt;br /&gt;
    &#039;redirect&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;embedded.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, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // The pagelayout used for reports.&lt;br /&gt;
    &#039;report&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;report.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;
    // The pagelayout used for safebrowser and securewindow.&lt;br /&gt;
    &#039;secure&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;true, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nologinlinks&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&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;
&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. It is also where the &amp;quot;add block&amp;quot; block is shown when editing is on.&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;
==Configuring the language file==&lt;br /&gt;
Open theme_base.php file from &#039;&#039;&#039;base/lang/en/theme_base.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Save it as &#039;&#039;&#039;Communicative Competence on-line/lang/en/theme_Communicative Competence on-line.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Change &lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Base&#039;; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
to&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Communicative Competence on-line&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After making these changes and perhaps clearing theme caches and/or purging all caches, the new theme name should now show properly in the Theme Selector: &#039;&#039;Site Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme Selector&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can also edit the theme description:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;Write your theme description here.&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to leave the following two lines in place (you can change the wording if you need to) to avoid notices when editing blocks etc.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&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;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Writing the layout file==&lt;br /&gt;
&lt;br /&gt;
The Communicative Competence on-line 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;
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;
So lets start writing standard.php, the layout file for my &#039;&#039;`Communicative Competence on-line`&#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;Communicative Competence on-line&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;Communicative Competence on-line&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 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;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;Communicative Competence on-line&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;Communicative Competence on-line&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;Units&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;Units&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 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;
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;Communicative Competence on-line&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 sure 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;Communicative Competence on-line&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; Communicative Competence on-line&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 show on the page.&lt;br /&gt;
&lt;br /&gt;
In both cases we choose to wrap them in a div tag with a class attribute to enable theming on those elements.&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;
PLEASE NOTE: In Moodle 2.2 onwards &amp;quot;core_renderer::MAIN_CONTENT_TOKEN&amp;quot; changed to &amp;quot;$OUTPUT-&amp;gt;main_content()&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($hassidepre) { ?&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
These lines of code check the variables we created earlier on to decide whether we should show the pre block region. If you try to display a block region that isn&#039;t there or has no content then Moodle will give you an error message so these lines are very important.&lt;br /&gt;
&lt;br /&gt;
For those who get an error message if it is &amp;quot;unknown block region side-pre&amp;quot; or &amp;quot;unknown block region side-post&amp;quot; then this is the issue you are experiencing. Simply add the following lines and all will be fine.&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 if ($hassidepost) { ?&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Again we should make this check for every block region as there are some pages that have no blocks what-so-ever.&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;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;Communicative Competence on-line&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 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;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;Communicative Competence on-line&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;Communicative Competence on-line&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;Communicative Competence on-line&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; Communicative Competence on-line&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;
&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]] and [[CSS coding style]] 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 {&lt;br /&gt;
    text-decoration: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.addcoursebutton .singlebutton {&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
h1.headermain {&lt;br /&gt;
    color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
h2.main {&lt;br /&gt;
    border-bottom: 3px solid #013D6A;&lt;br /&gt;
    color: #013D6A;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
h2.headingblock {&lt;br /&gt;
    font-size: 18pt;&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#page-header {&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#page-header .headermenu {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#page-header .headermenu a {&lt;br /&gt;
    color: #FDFF2A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbar {&lt;br /&gt;
    padding-left: 1em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.breadcrumb li {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.breadcrumb li a {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block {&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .header .title {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .header .title .block_action input {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .content {&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .content .block_tree p {&lt;br /&gt;
    font-size: 80%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer {&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform {&lt;br /&gt;
    margin-left: 5%;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
    font-size: 9pt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform #adminsearchquery {&lt;br /&gt;
    width: 95%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .calendar-controls a {&lt;br /&gt;
    color: #013D6A;&lt;br /&gt;
    font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar td {&lt;br /&gt;
    border-color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .day a {&lt;br /&gt;
    color: #FFF000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays th {&lt;br /&gt;
    border-width: 0;&lt;br /&gt;
    font-weight: bold;&lt;br /&gt;
    color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays abbr {&lt;br /&gt;
    border-width: 0;&lt;br /&gt;
    text-decoration: none;&lt;br /&gt;
}&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 {&lt;br /&gt;
    background-image: url([[pix:theme|background]]);&lt;br /&gt;
}&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 {&lt;br /&gt;
    background-image: url([[pix:theme|gradient]]);&lt;br /&gt;
    background-repeat: repeat-x;&lt;br /&gt;
    background-color: #0273C8;&lt;br /&gt;
}&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:860px;&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]]);&lt;br /&gt;
   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;
[[es:Desarollo:Temas 2.0 creando tu primer tema]]&lt;/div&gt;</summary>
		<author><name>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Creating_a_theme&amp;diff=43745</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=43745"/>
		<updated>2014-02-10T14:07:22Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&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;
; /lang/en/ : The file we put here will make our theme name show properly on the Theme Selector page. You need a few standard entries. Copy the one from the Standard theme and modify is easiest. &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;Communicative Competence on-line&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&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;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&#039;Communicative Competence on-line&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    // Most backwards compatible layout without the blocks - this is the layout used by default&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&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;
    // 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;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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // Main course page&lt;br /&gt;
    &#039;course&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;coursecategory&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // part of course, typical for modules - default page layout if $cm specified in require_login()&lt;br /&gt;
    &#039;incourse&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // The site home page.&lt;br /&gt;
    &#039;frontpage&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;frontpage.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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // Server administration scripts.&lt;br /&gt;
    &#039;admin&#039; =&amp;gt; array(&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;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    // My dashboard page&lt;br /&gt;
    &#039;mydashboard&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;langmenu&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // My public page&lt;br /&gt;
    &#039;mypublic&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;login&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.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;
&lt;br /&gt;
    // Pages that appear in pop-up windows - no navigation, no blocks, no header.&lt;br /&gt;
    &#039;popup&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.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, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nologininfo&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // No blocks and minimal footer - used for legacy frame layouts only!&lt;br /&gt;
    &#039;frametop&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.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;nocoursefooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // Embeded pages, like iframe/object embeded in moodleform - it needs as much space as possible&lt;br /&gt;
    &#039;embedded&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;embedded.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, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // Used during upgrade and install, and for the &#039;This site is undergoing maintenance&#039; message.&lt;br /&gt;
    // This must not have any blocks, and it is good idea if it does not have links to&lt;br /&gt;
    // other places - for example there should not be a home link in the footer...&lt;br /&gt;
    &#039;maintenance&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;noblocks&#039;=&amp;gt;true, &#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;true, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // Should display the content and basic headers only.&lt;br /&gt;
    &#039;print&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;noblocks&#039;=&amp;gt;true, &#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;false, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // The pagelayout used when a redirection is occuring.&lt;br /&gt;
    &#039;redirect&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;embedded.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, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&lt;br /&gt;
    // The pagelayout used for reports.&lt;br /&gt;
    &#039;report&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;report.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;
    // The pagelayout used for safebrowser and securewindow.&lt;br /&gt;
    &#039;secure&#039; =&amp;gt; array(&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-pre&#039;,&lt;br /&gt;
        &#039;options&#039; =&amp;gt; array(&#039;nofooter&#039;=&amp;gt;true, &#039;nonavbar&#039;=&amp;gt;true, &#039;nocustommenu&#039;=&amp;gt;true, &#039;nologinlinks&#039;=&amp;gt;true, &#039;nocourseheaderfooter&#039;=&amp;gt;true),&lt;br /&gt;
    ),&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;
&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. It is also where the &amp;quot;add block&amp;quot; block is shown when editing is on.&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;
==Configuring the language file==&lt;br /&gt;
Open theme_base.php file from &#039;&#039;&#039;base/lang/en/theme_base.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Save it as &#039;&#039;&#039;excitement/lang/en/theme_excitement.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Change &lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Base&#039;; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
to&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;pluginname&#039;] = &#039;Excitement&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After making these changes and perhaps clearing theme caches and/or purging all caches, the new theme name should now show properly in the Theme Selector: &#039;&#039;Site Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme Selector&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can also edit the theme description:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&#039;choosereadme&#039;] = &#039;Write your theme description here.&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to leave the following two lines in place (you can change the wording if you need to) to avoid notices when editing blocks etc.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&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;
&amp;lt;/code&amp;gt;&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;
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;
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 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;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 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;
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 sure 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 show on the page.&lt;br /&gt;
&lt;br /&gt;
In both cases we choose to wrap them in a div tag with a class attribute to enable theming on those elements.&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;
PLEASE NOTE: In Moodle 2.2 onwards &amp;quot;core_renderer::MAIN_CONTENT_TOKEN&amp;quot; changed to &amp;quot;$OUTPUT-&amp;gt;main_content()&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($hassidepre) { ?&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
These lines of code check the variables we created earlier on to decide whether we should show the pre block region. If you try to display a block region that isn&#039;t there or has no content then Moodle will give you an error message so these lines are very important.&lt;br /&gt;
&lt;br /&gt;
For those who get an error message if it is &amp;quot;unknown block region side-pre&amp;quot; or &amp;quot;unknown block region side-post&amp;quot; then this is the issue you are experiencing. Simply add the following lines and all will be fine.&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 if ($hassidepost) { ?&amp;gt;&lt;br /&gt;
....&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Again we should make this check for every block region as there are some pages that have no blocks what-so-ever.&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;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 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;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;
&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]] and [[CSS coding style]] 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 {&lt;br /&gt;
    text-decoration: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.addcoursebutton .singlebutton {&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
h1.headermain {&lt;br /&gt;
    color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
h2.main {&lt;br /&gt;
    border-bottom: 3px solid #013D6A;&lt;br /&gt;
    color: #013D6A;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
h2.headingblock {&lt;br /&gt;
    font-size: 18pt;&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#page-header {&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#page-header .headermenu {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#page-header .headermenu a {&lt;br /&gt;
    color: #FDFF2A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.navbar {&lt;br /&gt;
    padding-left: 1em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.breadcrumb li {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.breadcrumb li a {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block {&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .header .title {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .header .title .block_action input {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .content {&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block .content .block_tree p {&lt;br /&gt;
    font-size: 80%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer {&lt;br /&gt;
    text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform {&lt;br /&gt;
    margin-left: 5%;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
    font-size: 9pt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_settings_navigation_tree .content .footer .adminsearchform #adminsearchquery {&lt;br /&gt;
    width: 95%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .calendar-controls a {&lt;br /&gt;
    color: #013D6A;&lt;br /&gt;
    font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar td {&lt;br /&gt;
    border-color: #FFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .day {&lt;br /&gt;
    color: #FFF;&lt;br /&gt;
    background-color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .day a {&lt;br /&gt;
    color: #FFF000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays th {&lt;br /&gt;
    border-width: 0;&lt;br /&gt;
    font-weight: bold;&lt;br /&gt;
    color: #013D6A;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.block_calendar_month .content .minicalendar .weekdays abbr {&lt;br /&gt;
    border-width: 0;&lt;br /&gt;
    text-decoration: none;&lt;br /&gt;
}&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 {&lt;br /&gt;
    background-image: url([[pix:theme|background]]);&lt;br /&gt;
}&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 {&lt;br /&gt;
    background-image: url([[pix:theme|gradient]]);&lt;br /&gt;
    background-repeat: repeat-x;&lt;br /&gt;
    background-color: #0273C8;&lt;br /&gt;
}&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:860px;&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]]);&lt;br /&gt;
   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;
[[es:Desarollo:Temas 2.0 creando tu primer tema]]&lt;/div&gt;</summary>
		<author><name>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=43743</id>
		<title>Clean theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=43743"/>
		<updated>2014-02-10T13:52:44Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: /* Renaming Elements */&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;Communicative Competence On-Line&#039;&#039;&#039;. So using the above list as a guide, search through and change all the instances of the theme name &#039;Communicative Competence On-Line&#039; to &#039;cleantheme&#039;. This includes the filename of the lang/en/theme_Communicative Competence On-Line.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==    Communicative Competence On-Line&lt;br /&gt;
&lt;br /&gt;
If you need to override any renderers in your theme, then make sure you override the renderers by extending the parent theme renderers, which in this case is bootstrapbase. For example the class that you need to start your renderer with is as follows...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
class theme_Communicative Competence On-Line_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;
...where &#039;&#039;&#039;&#039;Communicative Competence On-Line&#039;&#039;&#039;&#039; requires you to change it to your theme name otherwise it will not work.&lt;br /&gt;
&lt;br /&gt;
(Please note: The normal recipe &amp;lt;tt&amp;gt;class theme_&#039;&#039;&#039;Communicative Competence On-Line&#039;&#039;&#039;_core_renderer extends core_renderer&amp;lt;/tt&amp;gt; is wrong for themes whose parent theme uses renderers, because this method will ultimately conflict with the parent theme&#039;s renderers.)&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>Ibrahim62</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=43742</id>
		<title>Clean theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Clean_theme&amp;diff=43742"/>
		<updated>2014-02-10T13:50:15Z</updated>

		<summary type="html">&lt;p&gt;Ibrahim62: &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==    Communicative Competence On-Line&lt;br /&gt;
&lt;br /&gt;
If you need to override any renderers in your theme, then make sure you override the renderers by extending the parent theme renderers, which in this case is bootstrapbase. For example the class that you need to start your renderer with is as follows...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
class theme_Communicative Competence On-Line_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;
...where &#039;&#039;&#039;&#039;Communicative Competence On-Line&#039;&#039;&#039;&#039; requires you to change it to your theme name otherwise it will not work.&lt;br /&gt;
&lt;br /&gt;
(Please note: The normal recipe &amp;lt;tt&amp;gt;class theme_&#039;&#039;&#039;Communicative Competence On-Line&#039;&#039;&#039;_core_renderer extends core_renderer&amp;lt;/tt&amp;gt; is wrong for themes whose parent theme uses renderers, because this method will ultimately conflict with the parent theme&#039;s renderers.)&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>Ibrahim62</name></author>
	</entry>
</feed>