]> git.mjollnir.org Git - moodle.git/commitdiff
Added some new settings to theme config.php so that a file meta.php can be
authormoodler <moodler>
Wed, 24 Jan 2007 09:20:32 +0000 (09:20 +0000)
committermoodler <moodler>
Wed, 24 Jan 2007 09:20:32 +0000 (09:20 +0000)
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).

lib/weblib.php
theme/standard/config.php
theme/standard/meta.php [new file with mode: 0644]

index 6368975dd7d0bd4da2ebcc950a8b657e03a97dd5..4d5e2fa7eedb414aefbe5be36d84271384253dc4 100644 (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;
index 5e38df1d8ef0f5a3a8b60e31f707888e9f001528..ffe2c2679cc3f56050bdd3562af5dd73c12b589e 100644 (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 
diff --git a/theme/standard/meta.php b/theme/standard/meta.php
new file mode 100644 (file)
index 0000000..a536d78
--- /dev/null
@@ -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]-->
+