Note:

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

Theme config file: Difference between revisions

From MoodleDocs
No edit summary
(Note about plan not to migrate this page to the new developer resources. See template for more info.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:WillNotMigrate}}
{{obsolete}}
{{obsolete}}


This is written for 1.9 and earlier versions of Moodle.  There will be a major change in Themes for Moodle 2.0.
This is written for 1.9 and earlier versions of Moodle.  There will be a major change in Themes for Moodle 2.0.
{{Themes}}


The theme '''config.php''' file contains configuration variables that control how Moodle uses a specific theme.
The theme '''config.php''' file contains configuration variables that control how Moodle uses a specific theme.
Line 9: Line 8:
== User styles ==
== User styles ==


<code php>
<syntaxhighlight lang="php">
$THEME->sheets = array('user_styles');
$THEME->sheets = array('user_styles');
</code>
</syntaxhighlight>


This variable is an array containing the names of all the style sheet files you want included in this theme, and in what order
This variable is an array containing the names of all the style sheet files you want included in this theme, and in what order


== Standard sheets ==
== Standard sheets ==
<code php>
<syntaxhighlight lang="php">
$THEME->standardsheets = array('styles_layout');
$THEME->standardsheets = array('styles_layout');
</code>
</syntaxhighlight>


This variable can be set to an array containing file names from the *STANDARD* theme. If the array exists, it will be used to choose the  files to include in the standard style sheet. When false, then no files are used. When true or NON-EXISTENT, then ALL standard files are used. This parameter can be used, for example, to prevent  having to override too many classes.  Note that the trailing .css should not be included e.g.:  
This variable can be set to an array containing file names from the *STANDARD* theme. If the array exists, it will be used to choose the  files to include in the standard style sheet. When false, then no files are used. When true or NON-EXISTENT, then ALL standard files are used. This parameter can be used, for example, to prevent  having to override too many classes.  Note that the trailing .css should not be included e.g.:  


<code php>
<syntaxhighlight lang="php">
$THEME->standardsheets = array('styles_layout','styles_fonts','styles_color');
$THEME->standardsheets = array('styles_layout','styles_fonts','styles_color');
</code>
</syntaxhighlight>


== Parent ==
== Parent ==


<code php>
<syntaxhighlight lang="php">
$THEME->parent = '';   
$THEME->parent = '';   
</code>
</syntaxhighlight>


This variable can be set to the name of a parent theme which you want to have included before the current theme. This can make it easy to make modifications to another theme without having to actually change the files If this variable is empty or false then a parent theme is not used.
This variable can be set to the name of a parent theme which you want to have included before the current theme. This can make it easy to make modifications to another theme without having to actually change the files If this variable is empty or false then a parent theme is not used.
Line 36: Line 35:
== Parent sheets ==
== Parent sheets ==


<code php>
<syntaxhighlight lang="php">
$THEME->parentsheets = false;   
$THEME->parentsheets = false;   
</code>
</syntaxhighlight>


This variable can be set to an array containing file names from a chosen *PARENT* theme.  If the  array exists, it will be used to choose the  files to include in the standard style sheet. When false, then no files are used. When true or NON-EXISTENT, then ALL standard files are used. This parameter can be used, for example, to prevent  having to override too many classes. Note that the trailing .css should not be included e.g.:  
This variable can be set to an array containing file names from a chosen *PARENT* theme.  If the  array exists, it will be used to choose the  files to include in the standard style sheet. When false, then no files are used. When true or NON-EXISTENT, then ALL standard files are used. This parameter can be used, for example, to prevent  having to override too many classes. Note that the trailing .css should not be included e.g.:  
<code php>
<syntaxhighlight lang="php">
$THEME->parentsheets = array('styles_layout','styles_fonts','styles_color');
$THEME->parentsheets = array('styles_layout','styles_fonts','styles_color');
</code>
</syntaxhighlight>


== Mod sheets ==
== Mod sheets ==
<code php>
<syntaxhighlight lang="php">
$THEME->modsheets = true;   
$THEME->modsheets = true;   
</code>
</syntaxhighlight>


When this is enabled, then this theme will search for  files named "styles.php" inside all Activity modules and  include them. This allows modules to provide some basic  layouts so they work out of the box. It is HIGHLY recommended to leave this enabled.
When this is enabled, then this theme will search for  files named "styles.php" inside all Activity modules and  include them. This allows modules to provide some basic  layouts so they work out of the box. It is HIGHLY recommended to leave this enabled.
Line 54: Line 53:
== Block sheets ==
== Block sheets ==


<code php>
<syntaxhighlight lang="php">
$THEME->blocksheets = true;   
$THEME->blocksheets = true;   
</code>
</syntaxhighlight>


When this is enabled, then this theme will search for files named "styles.php" inside all Block modules and  include them. This allows Blocks to provide some basic  layouts so they work out of the box. It is HIGHLY recommended to leave this enabled.
When this is enabled, then this theme will search for files named "styles.php" inside all Block modules and  include them. This allows Blocks to provide some basic  layouts so they work out of the box. It is HIGHLY recommended to leave this enabled.
Line 62: Line 61:
== Lang sheets ==
== Lang sheets ==


<code php>
<syntaxhighlight lang="php">
$THEME->langsheets = false;   
$THEME->langsheets = false;   
</code>
</syntaxhighlight>


By setting this to true, then this theme will search for a file named "styles.php" inside the current language directory. This allows different languages to provide  different styles.
By setting this to true, then this theme will search for a file named "styles.php" inside the current language directory. This allows different languages to provide  different styles.
Line 70: Line 69:
== Course format sheets ==
== Course format sheets ==


<code php>
<syntaxhighlight lang="php">
$THEME->courseformatsheets = true;
$THEME->courseformatsheets = true;
</code>
</syntaxhighlight>


When this is enabled, this theme will search for files  named "styles.php" inside all course formats and  include them. This allows course formats to provide  their own default styles.
When this is enabled, this theme will search for files  named "styles.php" inside all course formats and  include them. This allows course formats to provide  their own default styles.
Line 78: Line 77:
== Meta include ==
== Meta include ==


<code php>
<syntaxhighlight lang="php">
$THEME->metainclude = true;
$THEME->metainclude = true;
</code>
</syntaxhighlight>


When this is enabled (or not set!) then Moodle will try to include a file meta.php from this theme into the <head></head> part of the page.
When this is enabled (or not set!) then Moodle will try to include a file meta.php from this theme into the <head></head> part of the page.
Line 86: Line 85:
== Standard meta include ==
== Standard meta include ==


<code php>
<syntaxhighlight lang="php">
$THEME->standardmetainclude = true;
$THEME->standardmetainclude = true;
</code>
</syntaxhighlight>


When this is enabled (or not set!) then Moodle will try  to include a file meta.php from the standard theme into the  <head><head> part of the page.
When this is enabled (or not set!) then Moodle will try  to include a file meta.php from the standard theme into the  <head><head> part of the page.


== Parent meta include ==
== Parent meta include ==
<code php>
<syntaxhighlight lang="php">
$THEME->parentmetainclude = false;
$THEME->parentmetainclude = false;
</code>
</syntaxhighlight>


When this is enabled (or not set!) then Moodle will try  to include a file meta.php from the parent theme into the  <head><head> part of the page.
When this is enabled (or not set!) then Moodle will try  to include a file meta.php from the parent theme into the  <head><head> part of the page.
Line 101: Line 100:
== Nav menu width ==
== Nav menu width ==


<code php>
<syntaxhighlight lang="php">
$THEME->navmenuwidth = 50;
$THEME->navmenuwidth = 50;
</code>
</syntaxhighlight>


You can use this to control the cutoff point for strings in the navmenus (list of activities in popup menu etc) Default is 50 characters wide.
You can use this to control the cutoff point for strings in the navmenus (list of activities in popup menu etc) Default is 50 characters wide.
Line 109: Line 108:
== Make nav menu list ==
== Make nav menu list ==


<code php>
<syntaxhighlight lang="php">
$THEME->makenavmenulist = false;
$THEME->makenavmenulist = false;
</code>
</syntaxhighlight>


By setting this to true, then you will have access to a new variable in your header.html and footer.html called $navmenulist ... this contains a simple XHTML menu of  all activities in the current course, mostly useful for  creating popup navigation menus and so on.
By setting this to true, then you will have access to a new variable in your header.html and footer.html called $navmenulist ... this contains a simple XHTML menu of  all activities in the current course, mostly useful for  creating popup navigation menus and so on.


== Chameleon enabled ==
== Chameleon enabled ==
<code php>
<syntaxhighlight lang="php">
$THEME->chameleonenabled = false;
$THEME->chameleonenabled = false;
</code>
</syntaxhighlight>


By setting this to true it enables editing of the stylsheets. It is recommended to set this to false again once you're  satisfied with your theme.
By setting this to true it enables editing of the stylsheets. It is recommended to set this to false again once you're  satisfied with your theme.
Line 124: Line 123:
== Chameleon teacher edit enabled ==
== Chameleon teacher edit enabled ==


<code php>
<syntaxhighlight lang="php">
$THEME->chameleonteachereditenabled = false;
$THEME->chameleonteachereditenabled = false;
</code>
</syntaxhighlight>


If you use chameleon as a course theme setting this to true  will allow teachers on that course to edit the theme.  
If you use chameleon as a course theme setting this to true  will allow teachers on that course to edit the theme.  


== Resource mp3 player colors ==
== Resource mp3 player colors ==
<code php>
<syntaxhighlight lang="php">
$THEME->resource_mp3player_colors =  
$THEME->resource_mp3player_colors =  
  'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
  'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
  'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&'.
  'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&'.
  'font=Arial&fontColour=3333FF&buffer=10&waitForPlay=no&autoPlay=yes';
  'font=Arial&fontColour=3333FF&buffer=10&waitForPlay=no&autoPlay=yes';
</code>
</syntaxhighlight>


With this you can control the colours of the "big" MP3 player that is used for MP3 resources.
With this you can control the colours of the "big" MP3 player that is used for MP3 resources.


== Filter media plugin colors ==
== Filter media plugin colors ==
<code php>
<syntaxhighlight lang="php">
$THEME->filter_mediaplugin_colors =  
$THEME->filter_mediaplugin_colors =  
  'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
  'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
  'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&'.
  'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&'.
  'waitForPlay=yes';
  'waitForPlay=yes';
</code>
</syntaxhighlight>


This controls the small embedded player
This controls the small embedded player


== Custom pix ==
== Custom pix ==
<code php>
<syntaxhighlight lang="php">
$THEME->custompix = true;
$THEME->custompix = true;
</code>
</syntaxhighlight>


If true, then this theme must have a "pix"  subdirectory that contains copies of all  files from the moodlepix directory, plus a "pixmod" directory containing all the icons for all the activity modules.
If true, then this theme must have a "pix"  subdirectory that contains copies of all  files from the moodlepix directory, plus a "pixmod" directory containing all the icons for all the activity modules.
Line 159: Line 158:
{{Moodle 1.8}}When you need to define the side column width for your themes you can add the following settings to your theme config.php.
{{Moodle 1.8}}When you need to define the side column width for your themes you can add the following settings to your theme config.php.


<code php>
<syntaxhighlight lang="php">
$THEME->block_l_min_width = 148;
$THEME->block_l_min_width = 148;
$THEME->block_l_max_width = 148;
$THEME->block_l_max_width = 148;
Line 168: Line 167:
/// sideblocks in the course pages. If not set or false the standard  
/// sideblocks in the course pages. If not set or false the standard  
/// values are taken.
/// values are taken.
</code>
</syntaxhighlight>


==Change column order==
==Change column order==
{{Moodle 1.8}}When you need to change the column order for your themes you can add the following settings to your theme config.php.
{{Moodle 1.8}}When you need to change the column order for your themes you can add the following settings to your theme config.php.


<code php>
<syntaxhighlight lang="php">
$THEME->layouttable = array('left', 'right', 'middle');
$THEME->layouttable = array('left', 'right', 'middle');


Line 180: Line 179:
/// default order:
/// default order:
/// $THEME->layouttable = array('left', 'middle', 'right');
/// $THEME->layouttable = array('left', 'middle', 'right');
</code>
</syntaxhighlight>

Latest revision as of 14:09, 31 December 2022


Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.


Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.


This is written for 1.9 and earlier versions of Moodle. There will be a major change in Themes for Moodle 2.0.

The theme config.php file contains configuration variables that control how Moodle uses a specific theme.

User styles

$THEME->sheets = array('user_styles');

This variable is an array containing the names of all the style sheet files you want included in this theme, and in what order

Standard sheets

$THEME->standardsheets = array('styles_layout');

This variable can be set to an array containing file names from the *STANDARD* theme. If the array exists, it will be used to choose the files to include in the standard style sheet. When false, then no files are used. When true or NON-EXISTENT, then ALL standard files are used. This parameter can be used, for example, to prevent having to override too many classes. Note that the trailing .css should not be included e.g.:

$THEME->standardsheets = array('styles_layout','styles_fonts','styles_color');

Parent

$THEME->parent = '';

This variable can be set to the name of a parent theme which you want to have included before the current theme. This can make it easy to make modifications to another theme without having to actually change the files If this variable is empty or false then a parent theme is not used.

Parent sheets

$THEME->parentsheets = false;

This variable can be set to an array containing file names from a chosen *PARENT* theme. If the array exists, it will be used to choose the files to include in the standard style sheet. When false, then no files are used. When true or NON-EXISTENT, then ALL standard files are used. This parameter can be used, for example, to prevent having to override too many classes. Note that the trailing .css should not be included e.g.:

$THEME->parentsheets = array('styles_layout','styles_fonts','styles_color');

Mod sheets

$THEME->modsheets = true;

When this is enabled, then this theme will search for files named "styles.php" inside all Activity modules and include them. This allows modules to provide some basic layouts so they work out of the box. It is HIGHLY recommended to leave this enabled.

Block sheets

$THEME->blocksheets = true;

When this is enabled, then this theme will search for files named "styles.php" inside all Block modules and include them. This allows Blocks to provide some basic layouts so they work out of the box. It is HIGHLY recommended to leave this enabled.

Lang sheets

$THEME->langsheets = false;

By setting this to true, then this theme will search for a file named "styles.php" inside the current language directory. This allows different languages to provide different styles.

Course format sheets

$THEME->courseformatsheets = true;

When this is enabled, this theme will search for files named "styles.php" inside all course formats and include them. This allows course formats to provide their own default styles.

Meta include

$THEME->metainclude = true;

When this is enabled (or not set!) then Moodle will try to include a file meta.php from this theme into the <head></head> part of the page.

Standard meta include

$THEME->standardmetainclude = true;

When this is enabled (or not set!) then Moodle will try to include a file meta.php from the standard theme into the <head><head> part of the page.

Parent meta include

$THEME->parentmetainclude = false;

When this is enabled (or not set!) then Moodle will try to include a file meta.php from the parent theme into the <head><head> part of the page.

Nav menu width

$THEME->navmenuwidth = 50;

You can use this to control the cutoff point for strings in the navmenus (list of activities in popup menu etc) Default is 50 characters wide.

Make nav menu list

$THEME->makenavmenulist = false;

By setting this to true, then you will have access to a new variable in your header.html and footer.html called $navmenulist ... this contains a simple XHTML menu of all activities in the current course, mostly useful for creating popup navigation menus and so on.

Chameleon enabled

$THEME->chameleonenabled = false;

By setting this to true it enables editing of the stylsheets. It is recommended to set this to false again once you're satisfied with your theme.

Chameleon teacher edit enabled

$THEME->chameleonteachereditenabled = false;

If you use chameleon as a course theme setting this to true will allow teachers on that course to edit the theme.

Resource mp3 player colors

$THEME->resource_mp3player_colors = 
 'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
 'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&'.
 'font=Arial&fontColour=3333FF&buffer=10&waitForPlay=no&autoPlay=yes';

With this you can control the colours of the "big" MP3 player that is used for MP3 resources.

Filter media plugin colors

$THEME->filter_mediaplugin_colors = 
 'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
 'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&'.
 'waitForPlay=yes';

This controls the small embedded player

Custom pix

$THEME->custompix = true;

If true, then this theme must have a "pix" subdirectory that contains copies of all files from the moodlepix directory, plus a "pixmod" directory containing all the icons for all the activity modules.

Sideblock width

Moodle1.8 When you need to define the side column width for your themes you can add the following settings to your theme config.php.

$THEME->block_l_min_width = 148;
$THEME->block_l_max_width = 148;
$THEME->block_r_min_width = 260;
$THEME->block_r_max_width = 260;

/// These values define the min and max width of the left and right
/// sideblocks in the course pages. If not set or false the standard 
/// values are taken.

Change column order

Moodle1.8 When you need to change the column order for your themes you can add the following settings to your theme config.php.

$THEME->layouttable = array('left', 'right', 'middle');

/// These values define the order of the columns for all
/// pages showing sideblocks. If not set Moodle uses the 
/// default order:
/// $THEME->layouttable = array('left', 'middle', 'right');