Development:Theme directory guide: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Themes}} | {{Themes}} | ||
In the standard Moodle distribution, all themes are placed in the theme/ directory, this leads to developers hardcoding this location into their themes. 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, this leads to developers hardcoding this location into their themes and references to themes. Developers should not take this location for granted, and use the correct variables which moodle provides for this purpose. | ||
Starting with 1.7, moodle will fully support changing the location which themes are stored in. Developers need to ensure they are using the provided variables to ensure compatibility with this feature. | Starting with 1.7, moodle will fully support changing the location which themes are stored in. Developers need to ensure they are using the provided variables to ensure compatibility with this feature. |
Revision as of 13:46, 8 October 2006
In the standard Moodle distribution, all themes are placed in the theme/ directory, this leads to developers hardcoding this location into their themes and references to themes. Developers should not take this location for granted, and use the correct variables which moodle provides for this purpose.
Starting with 1.7, moodle will fully support changing the location which themes are stored in. Developers need to ensure they are using the provided variables to ensure compatibility with this feature.
$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'.