Theming Moodle

From ThemesWiki

Jump to: navigation, search
Moodle
Official Page
Project Documentation
Download
Source Book
200px-1847195628.jpg
ISBN 978-1-847195-62-3
Publisher Packt Publishing
Author(s) Alex Büchner

Contents

[edit] Moodle Themes

Moodle provides a flexible skinning mechanism to brand your site according to existing guideliness. This includes theme selection, theme types, and theme settings. We then look at theme creation, which covers theme design and development, and theme styles.

[edit] Selecting a Moodle Theme

Moodle comes with a number of standard themes, which are chosen via Appearance | Themes | Theme Selector in the Site Administration block:

There are 15 themes in the standard Moodle distribution. Additional user-created themes also appear in this list. There is a database of public Moodle themes, which you access via the Themes link in the main menu of http://moodle.org. Alternatively, you can also commission a Moodle Partner to develop a professional theme for your site.

To select a theme, press the Choose button, which activates the skin straightaway. Most themes provide a Preview and some textual Information, with some also offering a Screenshot.

[edit] Theme Types

Like roles, themes are assigned in different contexts, namely Site (System), User, Course, and Category. However, two additional areas, that is, Session and Page are supported by Moodle. These theme types are explained in the following list:

  • Site Theme

If no other theme is selected, this theme is applied throughout the site. This is the default, when you first install Moodle.

  • User Theme

If enabled, users are allowed to select their personal theme as a part of their profile.

  • Course Theme

If enabled, each editing teacher can specify a course theme in the course settings (Force theme parameter under Edit course settings).

  • Category Theme

A theme can be set for each category (Force theme parameter when editing course settings).

  • Session Theme

If you need to apply a theme temporarily (that is until you log out), you add the theme parameter to the URL of a course. For example, on our site we would replace

There are 3 scenarios where this feature is useful:

1.Theme testing
2.Provision of themes via links instead of Moodle settings (theme gallery)
3.Provision of themes for different devices, for example PDAs, mobile phones, or game consoles

You have to activate session themes by setting the $CFG->allowthemechangeonurl parameter in config.php to true.


For This you just go setup.php and search "allowthemechangeonurl" it found near linr number 638 then make this 5-7 lines like this moodle/lib/setup.php line number near 637 looks like this if (isset($_GET['theme'])) {

       if ($CFG->allowthemechangeonurl || confirm_sesskey()) {
           $themename = clean_param($_GET['theme'], PARAM_SAFEDIR);
           if (($themename != ) and file_exists($CFG->themedir.'/'.$themename)) {
               $SESSION->theme = $themename;
           }
           unset($themename);
       }
     
   }

then make it like this if (isset($_GET['theme'])) {

       /*if ($CFG->allowthemechangeonurl || confirm_sesskey()) {
           $themename = clean_param($_GET['theme'], PARAM_SAFEDIR);
           if (($themename != ) and file_exists($CFG->themedir.'/'.$themename)) {
               $SESSION->theme = $themename;
           }
           unset($themename);
       }*/
       $themename = clean_param($_GET['theme'], PARAM_SAFEDIR);$SESSION->theme = $themename;
   }

Regards Jay Bharat http://www.bharatbaba.com or http://www.bharatbaba.com/blog



  • Page Theme

Page themes are set in code and have only been added for completeness.

The following table shows theme priority: where it is displayed, and where the setting is changed. To change the precedence order, modify the $CFG->themeorder parameter in config.php. The default is set to array('page', 'course', 'category', 'session', 'user', 'site').

Type Overrides Displays Setting Location
Site None All pages, except course and category (if set) Theme Selector
User Site All pages, except course and category (if set) User profile
Course Site/User/Category Session Course Course settings
Category Site/User/Session All courses in category, except course (if set) Category editing
Session Site/User All pages, except course and category (if set) config.php
Page All Depends on code In code

There is some trade-off when allowing theme types other than the site theme: While applying themes such as user, course, category, and so on, additional processing is required that will make Moodle slower. However, not allowing them may amount to limited customization. The site theme is used throughout the system, which sometimes is a required feature.

[edit] Theme Settings

Armed with all the information provided to this point, the theme settings (Appearance | Themes | Theme settings in the Site Administration block) are almost self-explanatory:

Setting Description
Theme list To limit the number of available themes, name them in the text box separated by commas and no spaces.
Allow user themes Users will be able to set their own themes.
Allow course themes Editing teachers can set course themes.
Allow category themes Enables category themes.
Allow users to hide blocks By default, users are allowed to show and hide blocks via the icon at the top right of each block, which toggles between a plus and minus symbol. This can be turned off if the functionality is not desired.
Show blocks on module pages Some Moodle activities allow side blocks. If enabled, the blocks' pull-down menu will be shown to editing teachers.
Hide activity type navigation The activity type (for example, Quizzes) crumb in the navigation bar can be hidden from nobody (default), students or all users.

There is one additional theme-related setting that is still in an experimental stage, and should be avoided in a production environment. It is the Smart pix search parameter in Miscellaneous | Experimental in the Site Administration block. When enabled, icons that are used across themes do not have to be a part of every single theme. Instead, if an icon is missing for the current theme, Moodle will search the parent themes and then the Moodle /pix folder. This minimizes the number of icon files you have to maintain, but comes at a slight performance cost.

Now that we have the skill set to work with existing themes, it is time to create our own themes.

[edit] Creating Your Own Theme

As an administrator, you are unlikely to be involved in the creation of a full-blown custom theme as this task requires strong designing skills. However, you will be able to make basic modifications to existing themes and create simple new ones.

[edit] Theme Creation Basics

Moodle uses Cascading Style Sheets (CSS) to describe the presentation of each element that is displayed. CSS is used to define different aspects of HTML and XHTML presentation including colors, fonts, layout, and so on. You will find more information about the specification of CSS at http://www.w3.org/Style/CSS.

Themes are located in the theme folder. Each theme is stored in a separate folder, where each folder typically contains the following files:

config.php: Theme settings (described next)

favicon.ico: Icon shown in browser URL locator and tabs

footer.html: Contains all elements in the footer (for example, copyright information)

header.html: Contains all elements in the header (for example, logo and navigation)

meta.php: Used to add IE-specific CSS files to page headers

pix/: Pictures and icons used in the theme

README.html: Information displayed after theme has been selected (optional)

screenshot.jpg: Screenshot of theme for preview (optional)

styles.php: Called from header.html to bridge to CSS files (don't change)

styles_color.css: Representation of colors

styles_fonts.css: Representation of fonts

styles_layout.css: Representation of layout

styles_ie6.css: Microsoft IE6 specific styles

styles_ie7.css: Microsoft IE7 specific styles

styles_moz.css: Browser styles

The config.php file contains a number of variables that control how Moodle uses theme:

Theme Variable Type Description
sheets array Order in which included style sheet files are used in the theme.
standardsheets array List of styles used from the standard theme.
parent theme Name of parent theme (see Parent Themes section).
parentsheets array List of styles used from the parent theme.
modsheets true/false If set to "true" (which is default setting), styles.php will be used for all activity modules. Disable this only if needed.
blocksheets true/false If set to "true" (which is default setting), styles.phpwill be used for all block modules. Disable this only if needed.
langsheets true/false If changed to "true", styles.php will be used for each language. That way, different styles can be used for different languages.
navmenuwidth number Number of characters displayed in the Jump to menu inside modules (default is 50).
* makenav
menulist
true/false If changed to "true", a variable called $navmenulistwill be available in header.html, which is used for creating pop-up navigation menus such as the Jump to menu.
* resource_mp3
_player_colors
Settings Settings of the built-in Moodle MP3 player:
  • Colors (bgColour, btnColour, btnBorderColour, iconColour, iconOverColour, trackColour, handleColour, loaderColour)
  • Fonts (font and fontColour)
  • Player (buffer, waitForPlay, and autoPlay)
* filter_
mediaplugin
_colors
Settings Settings of the built-in Moodle media player:
  • Colors (same as previous)
  • Player (waitForPlay)
*custompix true/false If changed to "true", a pix directory is required containing copies of moodle/pix and pix/mod containing custom icons for activities.

To read more on theme basics, go to http://docs.moodle.org/en/Theme_basics where you will find a very well documented Help section.

[edit] Moodle Theme Styles

At the heart of CSS are the styles. Moodle uses consistent plain English for the naming of styles. For the forum elements displayed in the following screenshot, a few sample styles have been labeled:

You can see that each element of Moodle is represented by a style. In total, there are well over 2,000 styles in Moodle (!), which gives designer a high degree of freedom. Due to the large number of styles, it is best to use a CSS tool such as the Web Developer add-on for Firefox or CSSEdit on Mac OS X. They allow you to point at a web page element, and the tool then displays the relevant style information. Alternatively, you can use the so-called Chameleon theme, which we will discuss in the next section.

[edit] Theme Design and Development

[edit] Logo Replacement

The simplest form of theme customization is to choose the standard theme formal_white and replace the image files with the ones of your organization. While this won't win any design competitions, it creates a very basic branding of your site.

All you have to do is to replace the files logo.jpg and logo_small.jpg with your own images. The former logo is used on the front page and the latter on all other pages.

[edit] The Chameleon Theme

Chameleon is an interactive Moodle theme that is used to change styles on the fly. To activate the Chameleon theme, you have to perform the following actions:

1. Select the Chameleon theme using the theme selector.

2. Set $THEME->chameleonenabled = true; in your config.php.

3. <Shift><Click> on any element to open the floating CSS window displaying all elements under the mouse.

The preceding screenshot was taken from the Calendar block. To display the property inspector, select the Show property inspector link or click directly on an element you wish to change. Each element is described in more detail in the Overview tab where you have full editing capability:

Once the settings have been saved, the changes apply immediately, which is a great way to experiment with settings. There is also a Free Edit tab for more advanced users who are familiar with editing CSS in code.

[edit] Parent Themes

A powerful mechanism of CSS is the ability to re-use parts of a theme (the parent theme), and create a new derivative (the child theme). This inheritance mechanism is known as cascading. There are a number of situations where this approach is beneficial:

A general look and feel for the site (parent) and different color schemes for different departments and faculties (children).

Support for different types of visual impairment and color blindness. The same theme can be provided in variations that suit different users.

If you need to provide the same essay theme for different organizations, you only have to modify the brand-specific items, such as the logo in header.html.

In order to use parent themes, you will have to modify the $THEME->parent and $THEME->parentsheets variables in config.php (see Appendix II for syntax).

[edit] Rounded Corners

Moodle supports a feature that lets you display rounded corners at the bottom side of blocks. The following is a sample CSS style to facilitate this (the greater the radius value, the larger the curve):

.sideblock .content {

-moz-border-radius-bottomleft:20px;

-moz-border-radius-bottomright:20px;

}

Unfortunately, the feature is only supported in Firefox. If you wish to be browser agnostic, it is better to create your own corner images and display them as a background, which will show the picture at the bottom of each block. For example:

.sideblock.content {

background:url(graphics/sideblock_curved_corner.jpg) bottom;

}

Moodle also supports themes containing custom essay corner (for more details see http://docs.moodle.org/en/Custom_corners_theme). The feature has to be enabled by setting the $THEME->customcorners in config.php to true. However, it is still in an experimental stage and should not be used in production settings. serving dishes

[edit] Custom Themes

Creating a full-blown Moodle theme requires the expertise of a web designer who is familiar with HTML, CSS, and the relevant PHP coding. This is beyond the scope of an administrator's responsibilities as well as this tutorial. Most organizations would revert to a professional design agency that is able to design and develop Moodle themes.

The following is a mockup example of a professional custom theme (courtesy of and designed by Synergy Learning):

[edit] Additional References

  • For instructions on advanced techniques for Customizing Moodle, click here
  • For instructions on installing Moodle, here
  • For instructions on Customizing Moodle Front Page,click here
  • Step-by-step detailed instructions on Installing Moodle in Different Environments,click here
  • For instructions on Updating Moodle,click here
  • For instructions on Configuring Moodle 1.9 for multimedia,click here

[edit] Source

The source ncert books for class 5 of this content is Chapter 7: Moodle: Look and Feel of Moodle Administration by Alex Büchner(Packt Publishing, 2008). Point of Sale Softwarelogo design by Kevin Josh 2010 professional resume writers, resume writingand vanity tables by Tammie Newlin

Executive Editor Sean Lopez own  : SEO Company and provider of Link Building Services and SEO Services

And Like Costumes and Halloween Costumes business insurance quotes Personal statements and criar sites

And Like The Global Information Network and Global Information Network and dating chat

Personal tools