upgrading theme from 1.9 to 2 version

upgrading theme from 1.9 to 2 version

by Vladimir Rodic -
Number of replies: 7

Hello everyone,

this is my first post on this forum.

So, let's start, I got a request from the client to change the 1.9 custom build theme to be able to work with the 2 version of Moodle.

The bad thing is that it is not even able to be shown in the Theme Selector...

Is there any guide, which all changes should I make to a custom build theme for 1.9 in order to work with the version 2 of Moodle.

Thanks for the answers,

Vladimir

Average of ratings: -
In reply to Vladimir Rodic

Re: upgrading theme from 1.9 to 2 version

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Vladamir,

As you have found out, Moodle 1.9 themes are not compatible with Moodle 2.0.

There is a tutorial which explains how to create a Moodle 2.0 theme from scratch, which should help you, and if you are a web-designer you should have no trouble with it.

Development: Themes 2.0 creating your first theme

Of course it all depends on what your theme is like, which will decide if the change will be easy or difficult.

HTH

Mary

Average of ratings: Useful (1)
In reply to Mary Evans

Re: upgrading theme from 1.9 to 2 version

by Vladimir Rodic -

Hi Mary and thank you for such a quick reply.

I have seen that the themes are not compatible (1.9 and 2.0) and I have  found a tutorial for building scratch themes, but I was just hoping that there wasa way to use the old theme that was already build for a client for the version 1.9 with some specific changes.

So definitelly the fastest way to adopt a custom made 1.9 Moodle theme to the 2.0 version is to build it from scratch ?

Thanks in advance !

In reply to Vladimir Rodic

Re: upgrading theme from 1.9 to 2 version

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

You will need to keep your old theme's css sheets as much of it can be used, for colour and image presentation etc in your Moodle 2.0 theme. There are some variations to the way the CSS is written for images but once learned it is easy to adapt from old to new theme.

Mary

 

Average of ratings: Useful (1)
In reply to Mary Evans

Re: upgrading theme from 1.9 to 2 version

by Vladimir Rodic -

Thanks to your enormous help Mary I have managed to change the aardvark_lite theme for Moodle 2.0 to look exactly as "my" old theme did.

Only last mistery remains to be resolved... I have literally changed the files of the aardvark_lite theme and now I am having difficulties renaming the theme !

I've tried with renaming the folder and changing the $THEME->name variable in config.php but that is not enough and it end up returning me plugin_name in the theme selecotr as a theme name.

 

What else should I rename from the old theme to have the new name?

In reply to Vladimir Rodic

Re: upgrading theme from 1.9 to 2 version

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Vladimir,

Changing the name is the most difficult part of the change!  I wish it could be made easier, perhaps one day I can figure out how...but for the moment you will have to make all the changes manually.

Here's the list of places you need to make changes...

  1. lang/en/theme_aardvark_lite.php change to theme_yourthemename.php
  2. check for any reference to aardvark_lite and change it to your theme name inside the file theme_yourthemename.php (after renameing this file)
  3. renderers.php - if there is a file call renderers.php look inside this file and change any reference to the old theme name to your new theme name.
  4. profileblock.php - look inside profileblock.php and again change any reference to the old theme name to your new theme name.

I think that's it...but the best way to catch all problems with renaming a theme folder is turn debugging on before you try to select the theme in the Theme Selector.

Settings > Site Administration > Development > Debugging and enable the top box by selecting Developer: extra Moodle debug...

HTH

Mary

Average of ratings: Useful (1)
In reply to Mary Evans

Re: upgrading theme from 1.9 to 2 version

by Vladimir Rodic -

Hello Mary,

first of all I must say that I have turned the Theme settings -> Theme designer mode to Yes and I am using firebug tool in which I have turned off the caching so that all the changes are for sure immediatelly visible.

I've done the following steps:

1. renamed the folder of the theme

2. in config.ph changed the variable $THEME->name

3. changed the name of the language file in lang/en/ folder to theme_hartlauer

4. inside of the language file theme_hartlauer.php changed the variable $string['pluginname'] to 'Hartlauer' (I SUSPECT HERE SHOULD BE CHANGED THE PROBLEM FROM THE ATTACHMENT)

5. in renderers.php I have changed the name of the class to theme_hartlauer_core_renderer

6 in profileblock.php I have changed all the get_string's parameters to look into theme_hartaluer file.

I have searched throughout the whole project for the old name "aardvark" and it does not appear anywhere more !

RESULT: In the attachment You can see that in the Theme Selector the name of the theme is not changed and I have completely lost the profile block.

One other thing, how can I see these PHP_ERRORS I should be getting from the Developer:extra Moodle debug... ?

In reply to Vladimir Rodic

Re: upgrading theme from 1.9 to 2 version

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

4. Should read like so...

$string['pluginname'] = 'Hartlauer';

Go back to the Debugging settings page, you might need to check another box to select how you want errors to appear.

You LOST the profileblock? How? Erased? can't be!!!