Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:Creating a theme

From MoodleDocs

Wow! Is the code for this theme available in a file, say in Modules and Plugins? Or did I miss it in my quick look. I can see my next project at work. --Chris collman 12:07, 6 April 2010 (UTC)

Hi Chris, the code in this tutorial isn't available anywhere the reason being that it is entirely based on the base theme :) check out theme/base/* you'll notice that what is in there is very close to the code I wrote for this tutorial. --Sam Hemelryk 01:33, 7 April 2010 (UTC)

Hi Sam, I did not look, why get confused by reality and numb about :) I sort of got here by creating a 1.9.8 localhost that I could do screenshots for Standard themes and then tried my first complete install package of 2.0 in 3 months. My primary goal is to revamp the 'navigation' and organization of Category:Themes pages, your instructions are going to help me. Thanks for all your time and efforts. --Chris collman 11:26, 7 April 2010 (UTC)

Good crisp documentation!! Thank you Sam for this :) You ve made our lives easier with 2.0 themes!! ;)

Cheers!! --Navin Dutta 03:12, 13 April 2010 (UTC)

Question about instruction

Sam, your instructions say there will only be one layout php file called standard.php. What is the general.php file pointer doing in config.php under base? If I understand things, it should be pointed to the theme base (which has a general.php) or the file should be called standard.php. Is that correct?

It is snowing, so I thought I would see if I could follow your instructions and do something like standardlogo in 1.9 for fun. No doubt will crash and burn with this part time project over the next 2 years :) Thanks --Chris collman 13:12, 16 April 2010 (UTC)

Broken :-(

Hello,

Thanks for the tutorial, but with - Moodle 2.0 Preview 2 (Build: 20100531) - I get the error 'Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post' when trying to select the theme for modern browsers.

Update: I've made the changes required to solve the problem after reading: http://moodle.org/mod/forum/discuss.php?d=150190

Cheers,

Gareth

Layouts

The need for the layout definitions is mentioned but not what they or what they do. This either needs explained or a link to where it is explained. It certainly isn't obvious --Howard Miller 17:18, 12 July 2010 (UTC)

Is this what???

Sorry guys, I think this is confusing Please understand that I am not that technically literate so I need things said a lot clearer:

config.php

   All of our settings will go here. 

/style/

   This directory will contain all of our stylesheets. 

/style/excitement.css

   All of our css will go in here. 

/pix/

   Into this directory we'll put a screen shot of our theme as well as our favicon and any images we use in CSS. 

/layout/

   Our layout files will end up in this directory. 

/layout/standard.php

   This will be our one basic layout file. 

There is a clear difference between a file and a directory - but the manner in which the above example is set up does not appear to make that distinction. Could it not be better put like:

Create the theme directory/folder, which we are calling "excitement". Into that directory/folder we create a file:

 config.php 
   All of our settings will go here.

Then we create the directories/folders

 /style/  
     This directory/folder will contain all of our stylesheets. 
 /pix/ 
     Into this directory/folder we'll put a screen shot of our theme as well as our favicon and any images we use in CSS. 
 /layout/ 
     Our layout files will end up in this directory/folder. 

Into the style directory/folder we create a file:

excitement.css 
   Where we place All of our css rules. 

And in the layout directory/folder we create a file:

 standard.php 
   This will be our one basic layout file. 

For me, not being that smart, this is a far more easily understood structure than has been shown.

Configuring Our Theme

The DIV that contains the config.php code had a vertical scrollbar. This is because the DIV around the code had a height of 400. This is fine when you are reading this document on the computer, but when you print it a large part of the php ($THEME->layouts = array) is chopped off. I increased the DIV height to 1780 and it solves the printing problem. Is this ok?

--Luis de Vasconcelos 15:54, 2 November 2010 (UTC)