Hi Tony & David.
1- The workaround for customizing
CSS for
one course only does cause a problem when it points to a non-existent
style sheet in a course's root directory. Curiously the problem seems
to appear only when someone logs in as guest. Then, on the very first
display of a course without its own stylesheet, the
URL shows up as,
e.g. http://yoursite/moodle/file.php/8/styles.css
& the following message is displayed:
Sorry, the requested file could not be foundContinue2- So I tried to apply David's solution (
22 September 2004).
However, I had to solve two problems.
a) there is a little syntax error
instead of :
if (file_exists($CFG->dataroot/$current_course_id/styles.css))
we should have:
if (file_exists("$CFG->dataroot/$current_course_id/styles.css"))
(commas missing)
b) // print the extra css line should read:
print('<link rel="stylesheet" type="text/css" href="'."$CFG->wwwroot/file.php/$course->id/styles.css".'">');
(all on one line)
3- To recap, to make sure that David's genial workaround works in all cases (i.e. for courses which have their own CSS stylesheet & for those who don't, without displaying any error message):
1. Ask our Moodle admin (or webmaster or root) to edit file header.html in current theme subdirectory
2. Find the lines (around line-number 6-7)
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<link rel="stylesheet" type="text/css" href="<?php echo $styles >" />
3. After these lines, add the following:
<?php
$current_course_id = $course->id ? $course->id : 1;
// if course id is not set use 1 instead
// (it means site home page)
if (file_exists("$CFG->dataroot/$current_course_id/styles.css")) {
print('<link rel="stylesheet" type="text/css" href="'."$CFG->wwwroot/file.php/$course->id/styles.css".'">');
}
unset($current_course_id);
?>
Enjoy!
Joseph_R