Note:

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

Theme directory guide: Difference between revisions

From MoodleDocs
No edit summary
(Replaced content with "{{obsolete}} This page text has been deleted because it was inaccurate and out of date. To see the previous text for this page check the history.")
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Themes}}
{{obsolete}}


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, instead using the variables which moodle provides for the purpose of specifying a theme location.
This page text has been deleted because it was inaccurate and out of date. To see the previous text for this page check the history.
 
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 ==
'''This variable has been available since version 1.5.1'''
 
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 ==
{{Moodle 1.7}}
'''This variable will be introduced in version 1.7'''
 
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 ==
'''This variable has been available since 1.5.1'''
 
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'.
 
== How to refer to the current theme directory ==
The most common use of the theme directories will be used to specify the current theme directory.
 
The correct way to do this is:
<pre>
$CFG->themewww .'/'. current_theme() 
</pre>
 
Or to include a theme file:
<pre>
$CFG->themedir .'/'. current_theme() 
</pre>

Latest revision as of 07:56, 1 December 2016

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


This page text has been deleted because it was inaccurate and out of date. To see the previous text for this page check the history.