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).
This commit is contained in:
moodler 2007-01-24 09:20:32 +00:00
parent fcdd946422
commit 79f533c388
3 changed files with 59 additions and 0 deletions

View File

@ -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;

View File

@ -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
/// <head></head> 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
/// <head></head> 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
/// <head></head> part of the page.
$THEME->navmenuwidth = 50;
/// You can use this to control the cutoff point for strings

8
theme/standard/meta.php Normal file
View File

@ -0,0 +1,8 @@
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="<?php echo $CFG->wwwroot ?>/theme/standard/ie7.css" />
<![endif]-->
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="<?php echo $CFG->wwwroot ?>/theme/standard/ie6.css" />
<![endif]-->