Start from scratch or use a parent theme?

Start from scratch or use a parent theme?

by Anna Fusté -
Number of replies: 2

Hi, I'm new with moodle and have some problems trying to understand the steps to create a new theme. It may be a language problem cause I'm spanish... however, if someone could help me I'd be very grateful.

I'm working for a company that wants to create a social net with moodle. I have to design the company image for the web so I have to create a theme according to the company necessities. But I'm already stuck at the beginning. If I copy the theme and then alter the content, will it be difficult to actualize the program for future versions? In that case, I don't understand what I have to do with the parent theme (explained in the tutorial, but i'm kind of stupid...confuso).

Start from scratch or use a parent theme? (tutorial)

You can now start to alter the features of the theme you have just copied, or choose to set it to use another theme as the parent, in which case your theme will use the parent theme's styles as a base, plus any changes you make. This is better than copying the entire folder of that theme and changing it, as sometimes the developers will make changes to the original theme to keep up with new Moodle features. These changes will not be included if you take the whole folder and alter it, but using another theme as a parent means that that original theme will be unchanged and will be updated when you update the rest of Moodle, avoiding messy surprises.

Use code like this this in /theme/yourtheme/config.php

$THEME->sheets = array('user_styles'); $THEME->standardsheets = array('styles_layout'); $THEME->parent = 'custom_corners'; // put the name of the theme folder you want to use as parent here. $THEME->parentsheets = array('user_styles');

you then lose all .css files except user_styles.css, which should be empty, where you start to add css as described below.

If someone could help...that would be great

anna

Average of ratings: -
In reply to Anna Fusté

Re: Start from scratch or use a parent theme?

by Patrick Malley -
All of my themes are built on top of the Standard theme (they use Standard as their parent).

Here's an example why this is a good idea:

When I upgraded to 1.9, my Standard theme was upgraded with it. Since my themes load the Standard theme before they load, all of them looked relatively intact even when looking at the new "Tag" pages that weren't around when the themes were created.

Had I not used Standard as a parent theme, I would have had to do a lot more troubleshooting to figure out what my themes were missing from the new release.

So, do you trust that you will be able to keep up with the Moodle changes enough to fix your theme through each Moodle upgrade?
In reply to Patrick Malley

Re: Start from scratch or use a parent theme?

by Anna Fusté -
thanks, finally I understood what I had to do. I'll use a copy of the standard theme.
thanks again.
Anna