Difference between revisions of "Theme location"

Jump to: navigation, search
Line 3: Line 3:
 
In the standard Moodle distribution, all themes are placed in the theme/ directory of moodle, this leads to theme developers hardcoding this location into their themes. Theme developers should not take this for granted, and use the variables which moodle provides for this purpose.
 
In the standard Moodle distribution, all themes are placed in the theme/ directory of moodle, this leads to theme developers hardcoding this location into their themes. Theme developers should not take this for granted, and use the variables which moodle provides for this purpose.
  
Starting with Moodle 1.7, the location for themes with be able to be altered for use with the theme selector.
+
Starting with 1.7, moodle will fully support changing the location of themes using the variables discussed below.
  
 
== $CFG->themewww ==
 
== $CFG->themewww ==
 
The ''$CFG->themewww'' variable contains the web-accessible location of the theme directory. If it is not set by the site administrator it will be the default of $CFG->wwwroot . '/theme'. i.e. 'http://my.moodle.site/theme'.
 
The ''$CFG->themewww'' variable contains the web-accessible location of the theme directory. If it is not set by the site administrator it will be the default of $CFG->wwwroot . '/theme'. i.e. 'http://my.moodle.site/theme'.
  
 +
== $CFG->httpsthemewww ==
 +
The ''$CFG->httpsthemewww' (introduced in Moodle 1.7) variable contains the same information as $CFG->themewww with the correct http/https prefix. This  should be used to provide proper operation of https protected pages.
  
 
== $CFG->themedir ==
 
== $CFG->themedir ==

Revision as of 12:46, 8 October 2006


In the standard Moodle distribution, all themes are placed in the theme/ directory of moodle, this leads to theme developers hardcoding this location into their themes. Theme developers should not take this for granted, and use the variables which moodle provides for this purpose.

Starting with 1.7, moodle will fully support changing the location of themes using the variables discussed below.

$CFG->themewww

The $CFG->themewww variable contains the web-accessible location of the theme directory. If it is not set by the site administrator it will be the default of $CFG->wwwroot . '/theme'. i.e. 'http://my.moodle.site/theme'.

$CFG->httpsthemewww

The $CFG->httpsthemewww' (introduced in Moodle 1.7) variable contains the same information as $CFG->themewww with the correct http/https prefix. This should be used to provide proper operation of https protected pages.

$CFG->themedir

The $CFG->themedir variable contains the local location on the moodle server of the theme directory. If it is not set by the site administrator it will be the default of $CFG->dirroot . '/theme'. i.e. '/my/moodle/location/theme'.


Changing theme Location

Starting from Moodle 1.7, the location of themes may be altered, using the variables $CFG->themewww and $CFG->themedir

If you wish to place themes in a subdirectory called 'my_moodle_themes', your config.php might look like this:

$CFG->wwwroot   = 'http://my.moodle.site.edu';
$CFG->dirroot   = '/var/www/my.moodle.site.edu/public_html';
$CFG->themewww  = $CFG->wwwroot . '/my_moodle_themes';
$CFG->themedir  = $CFG->dirroot . '/my_moodle_themes';