Quick Moodle Theme Tweak

For special events I like to change the main Moodle theme a little. Using this tweak I can make something happen at automatically for a single day.

In your theme/layout folder are a number of files that relate to the various layouts that it supports. There will usually be a file called frontpage that is your frontpage template, incourse that is your main course page template and a few others.

Each of these has a line towards the top that contains

$bodyclasses = array();

immediately after this place

$bodyclasses[] = date('MdY');

This will place into the body tag of your Moodle page a date class, something like Nov162012 (Note: class names can not start with a number!)

Then in your theme css you can place something like

.Nov162012{
	background:url([[pix:theme|wallpapers/CINtile3]]) repeat fixed 73px 35px #2E2E2E !important;
}

As a result on Children in Need day the site had a spotty wallpaper for all users.

cintile

Leave a Reply

Your email address will not be published. Required fields are marked *