Moodle

enable custom css for each course theme

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Not a bug
  • Affects Version/s: 1.9
  • Fix Version/s: None
  • Component/s: Themes
  • Labels:
    None
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE

Description

this tiny patch, enables custom CSS layouts for each course that uses the theme
that implement this patch.

open the header.html file of any theme and add the following line inside the <head> section

<LINK REL=StyleSheet HREF="<?php echo "$CFG->wwwroot/file.php/$COURSE->id/custom_style.css" ?>" TYPE="text/css" MEDIA=screen>

OR

<?php
      if (file_exists("$CFG->dataroot/$COURSE->id/custom_style.css")) {
        echo "<link rel=stylesheet href=\"$CFG->wwwroot/file.php/$COURSE->id/custom_style.css\" type=\"text/css\" media=\"screen\">";
      }
    ?>

now, make sure the teacher knows it has to place the CSS markup inside a file called "custom_style.css" on the
root of the course's "files" (and folders) section.

teachers use this (on our side of the globe) to hide sections, change font sizes, change header images (school logo)...
and add some personal touch to their virtual class

Activity

Hide
Rossiani Wijaya added a comment -

Thank you Nadav Kavalerchik.

Closing

Show
Rossiani Wijaya added a comment - Thank you Nadav Kavalerchik. Closing
Hide
Gareth Barnard added a comment -

Could this functionality be placed in terms of concept with the existing course theme functionality? -> http://docs.moodle.org/en/admin/setting/themesettings#Course_themes

Show
Gareth Barnard added a comment - Could this functionality be placed in terms of concept with the existing course theme functionality? -> http://docs.moodle.org/en/admin/setting/themesettings#Course_themes
Hide
Patrick Malley added a comment -

Hello Petr,

This seems applicable to the work you're doing.

Show
Patrick Malley added a comment - Hello Petr, This seems applicable to the work you're doing.

Dates

  • Created:
    Updated:
    Resolved: