From: moodler Date: Wed, 24 Jan 2007 09:20:32 +0000 (+0000) Subject: Added some new settings to theme config.php so that a file meta.php can be X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=79f533c38844d109531957d0f378a75048efb701;p=moodle.git Added some new settings to theme config.php so that a file meta.php can be automatically included into the HEAD section of the current theme. Supports parent and standard files too. I added this to support the inclusion of some IE specific CSS :-( which needs to be done from HTML and not CSS, (MDL-7782) but it could be used to include other things as well, or even to run some PHP code, set various vriables etc without messing up the theme header.html (and regardless of the theme being used). --- diff --git a/lib/weblib.php b/lib/weblib.php index 6368975dd7..4d5e2fa7ee 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1981,6 +1981,35 @@ function print_header ($title='', $heading='', $navigation='', $focus='', } $meta = $stylesheetshtml.$meta; + +/// Add the meta page from the themes if any were requested + + $metapage = ''; + + if (!isset($THEME->standardmetainclude) || $THEME->standardmetainclude) { + ob_start(); + include_once($CFG->dirroot.'/theme/standard/meta.php'); + $metapage .= ob_get_contents(); + ob_end_clean(); + } + + if ($THEME->parent && (!isset($THEME->parentmetainclude) || $THEME->parentmetainclude)) { + ob_start(); + include_once($CFG->dirroot.'/theme/'.$THEME->parent.'/meta.php'); + $metapage .= ob_get_contents(); + ob_end_clean(); + } + + if (!isset($THEME->metainclude) || $THEME->metainclude) { + ob_start(); + include_once($CFG->dirroot.'/theme/'.current_theme().'/meta.php'); + $metapage .= ob_get_contents(); + ob_end_clean(); + } + + $meta = $meta."\n".$metapage; + + if ($navigation == 'home') { $home = true; diff --git a/theme/standard/config.php b/theme/standard/config.php index 5e38df1d8e..ffe2c2679c 100644 --- a/theme/standard/config.php +++ b/theme/standard/config.php @@ -88,6 +88,28 @@ $THEME->courseformatsheets = true; /// their own default styles. +$THEME->metainclude = false; + +/// When this is enabled (or not set!) then Moodle will try +/// to include a file meta.php from this theme into the +/// part of the page. + + +$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 +/// part of the page. + + +$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 +/// part of the page. + + $THEME->navmenuwidth = 50; /// You can use this to control the cutoff point for strings diff --git a/theme/standard/meta.php b/theme/standard/meta.php new file mode 100644 index 0000000000..a536d78241 --- /dev/null +++ b/theme/standard/meta.php @@ -0,0 +1,8 @@ + + + +