Problem cloning essential theme

Problem cloning essential theme

by Mari Cruz García -
Number of replies: 44

Hello,

First of all, I would like to thank Gareth for continuing the Essential theme and for the excellent theme that he developed for Moodle 2.9.


We use Essential for our postgraduate Moodle site (still under development):

https://pgmed.dundee.ac.uk/

I just cloned the theme because we want to have a different heading for each of the postgraduate programmes (I tried to create  a child theme, but I found more complicated to find out how to display the header box for the child theme, since the theme uses a lot renderers)

I am totally sure that I have replaced all the language strings correctly, as I have used version control software for that. However, the new clone theme does not save the new header and when I navigate to Appearance ->Theme ,

I can see two themes called 'Essential' and I am completely sure that the theme name has been changed correctly because for the rest of the screens is displayed properly.

I saw that there is a json file with an installer or something called 'essential' (which I haven't renamed) and I wonder if this is causing the problem.

Let me know if there is something that I have missed when cloning the theme.


Regards,

Mari Cruz

Average of ratings: -
In reply to Mari Cruz García

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Mari,

To be honest if you are having trouble cloning the Essential theme then you will still bump into the same issues that you are experiencing with the child theme as its the same technology.  I strongly recommend not cloning the Essential theme as it is:

  1. Complex.
  2. You spend lots of time maintaining the clone when I update Essential.

That is why I introduced the child theme capability.  The child theme will take around fifteen minutes to clone, Essential on the other hand many, many hours I believe, as I've not actually done it but can see what a nightmare it would be.

Therefore all you have to do to have a changed header is make a child theme.  Then put this file 'https://github.com/gjb2048/moodle-theme_essential/blob/master/layout/includes/header.php' in the same 'layout/includes/' folder of the child theme, change it to what you want and the code will do the rest, including detecting it from all of the layouts and using it instead of the parent Essential.

Cheers,

Gareth

In reply to Gareth J Barnard

Re: Problem cloning essential theme

by Mari Cruz García -

Hello Gareth,

Thank you for your prompt answer. I thought that the essentials child could be used for that.

I install the folder /essential as a new theme and add the file:


theme\essential\layout\includes\header.php


to folder essentials\layout\includes\header.php 

as you suggested, however, within the Admin menu ->Theme I didn't see any option for uploading the logo of the child theme Essentials.


I know that I can embed the logo of the header.php of the child theme, but I don't think it would be a good practice as we don't have to the server. We have to pass the php files to a different team and wait for them to upload the files in the server.

It would be useful if we could upload the logo in the same way that Essential does it. However, I cannot see how to do that from the child theme  

In reply to Mari Cruz García

Re: Problem cloning essential theme

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

Hi Mari Cruz,

I do not understand why you want to make a 'child' theme of Essential. It is just as easy to use the theme as it is. If it gets updated in a future version, all you would be required to do update Essential theme via the Admin interface. It is no different that updating other plugins, that is why there is a Plugins check when updating Moodle. If you go to Admin  Notifications it will tell you if there are any updates available.

Otherwise I do not see the point in having a theme if you are not prepared to use it as is!

Hope this helps?

Mary

In reply to Mary Evans

Re: Problem cloning essential theme

by Mari Cruz García -

Hello Mary,

Yes, I totally I agree that Essential is an outstanding theme. However, I have been asked to customise a different heading for one of our postgraduate programmes of our Medical School. Because all the postgraduate programmes at the School share the same heading, the only way I can think of implementing this is creating a child them in which I can add the header from the admin menu.

Then, all the courses under the category of that postgraduate programme will use the child theme.

I  don´t think that there is another way of achieving it otherwise.


Regards,

Mari Cruz

In reply to Mari Cruz García

Re: Problem cloning essential theme

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

Hi 

When you say 'heading' do you mean the heading on the front page?

If so then I can understand Your anxiety.

I tried to make alterations to the essentials child theme...but could not get it to work the way I wanted.

I guess that is because Essential is self contained, and not reliant on Bootstrapbase, although it does use some of the styles.

What I cannot understand is that the Essentials excludes the parent styles, so looks prett drab.

To add settings you need to add the settings page and rename essential to essentials so to do that for all the child themes you want is a lot of work.

Sorry things are not as easy as they used to be as I know you got me use to work in older child thems.

I wish I could help more but sadly I do not understand the Essentisl theme...its way past my coding skills which are very poor in comparison to others here.

Regards

Mary

In reply to Mary Evans

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Remove this if you want the styles: https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/config.php#L33-L41.  They are excluded in the first instance so that you can have a 'blank canvas' upon which to work from, so 'template I can make my own painting on' rather than 'drab' smile.

Essential in essence 'contains' all of Bootstrapbase.  The technology in it or the child theme 'Essentials' is no different when adapting it to any other theme.  I've just created code to make child themes easier.

In reply to Gareth J Barnard

Re: Problem cloning essential theme

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

Hi,

In that case Gareth, your helping hand is probably making it harder to use. What people need is a child theme that works out of the box, but one that can be cloned easily, time and time again, so that Moodlers can create a set of course themes. So works like the parent but each child theme looks different.

Thanks

Mary

In reply to Mary Evans

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok then, a challenge for you Mary, create a working child of Essential without using any of my code.  One that still applies all of Essential's settings without duplicating them in the child, does not have to copy all of the 'includes' but instead only use the ones that need to be changed and uses them in the 'layouts' without the child theme needing to copy all of them too with no changes from the parent.

'Essentials' works out of the box, can be cloned easily and has instructions contained within it on how to modify it, what more do you want?  In five minutes or less, I've attached my version of Essentials which has the Essential styles after following my own instructions, starting with the 'config.php' file.  Time is ticking.... smile

In reply to Gareth J Barnard

Re: Problem cloning essential theme

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

I can't get the breadcrumb to work!... Is it hard coded somewhere?

In reply to Mary Evans

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Watching Downtrodden Abbey, so this is from memory.  There are four styles and the one that compresses uses JavaScript.

In what way not working?

In reply to Gareth J Barnard

Re: Problem cloning essential theme

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

SNAP to DA

In reply to Mary Evans

Re: Problem cloning essential theme

by Mari Cruz García -

I didn't realise that the conversation had continued from my last post, when I was creating the setting.php file.

Time to go to bed now, but tomorrow I will try to understand the tips that Gareth is suggesting in his last post.

In reply to Mary Evans

Re: Problem cloning essential theme

by Mari Cruz García -

Hi Mary,

When I wrote 'the heading' I mean the logo should be different for some courses. Rather than modifying the /layout/include/header.php file of the Essentials theme, I thought  of uploading the logo from the admin menu of the child,


However, even after creating a setting.php file it doesn't work:

 */


defined('MOODLE_INTERNAL') || die;

if ($ADMIN->fulltree) {


    // Logo file setting.

    $name = 'theme_essentials/logo';

    $title = get_string('logo','theme_essentials');

    $description = get_string('logodesc', 'theme_essentials');

    $setting = new admin_setting_configstoredfile($name, $title, $description, 'logo');

    $setting->set_updatedcallback('theme_reset_all_caches');

    $settings->add($setting);



    

}

so although it is not a recommend practice, I think that the fastest should be that I modify the heading.php file adding the logo as an image source

In reply to Mari Cruz García

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Mari,

As with any theme, adding the setting, which is the new 'theme_essentials/logo' here, is only one part of the story.  You still need the supporting code to replace a setting tag in the CSS (somewhere in the you'd add a setting tag as per the other examples): https://github.com/gjb2048/moodle-theme_essential/blob/master/lib.php#L261-L263 and serve it: https://github.com/gjb2048/moodle-theme_essential/blob/master/lib.php#L46-L47 etc.  This is the same as adding a logo to any other theme.  Humm, might be a quicker way to reuse what is there.... need to think.

Gareth

In reply to Gareth J Barnard

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, educated guess, with that new setting in Essentials, put this: https://github.com/gjb2048/moodle-theme_essential/blob/master/lib.php#L261-L263 just before here: https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/lib.php#L27.

Then in lib.php, add the 'essentials' version of: https://github.com/gjb2048/moodle-theme_essential/blob/master/lib.php#L40-L72 - renaming, removing the other 'else if's to leave only the logo and make the theme config load 'essentials'.

Also comment this out: https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/config.php#L35-L41 and set this to true: https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/lib.php#L30 ;

In reply to Mari Cruz García

Re: Problem cloning essential theme

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Just as a slightly different way to achieve this - you could look at the work I did for Chris Kenniburg recently, which uses the course image as a header banner - It wouldn't take much tweaking of css to use it as a logo (small image) rather than a banner.

https://moodle.org/mod/forum/discuss.php?d=321604#p1291375

In reply to Richard Oelmann

Re: Problem cloning essential theme

by Mari Cruz García -

Hello,

Following Gareth's advice (although Richard's suggestion is very handy), I have created an Essentials child theme of Essential which supports a different type of banner/logo.

The child them is available at:
https://www.dropbox.com/s/4wqir85bwdveo3k/essentials.zip?dl=0


I can also write down the steps so that Moodle users know how to do that as it would be very useful.


As you are the administrators of the Moodle Theme documentation, where should I write it down: in the plug-in comments or the wiki?... I just don't want to mess around with the documentation wiki.

Regards,

Mari Cruz

In reply to Mari Cruz García

Re: Problem cloning essential theme

by Sheila Owen -

Hi guys. I have a question which I hope you can solve regarding Essential child themes. I understand how the "Essentials" child theme works, but I need to have more than one child theme as we have different clients sharing our Moodle Totara site. How would I go about making multiple Essential child themes?

In reply to Sheila Owen

Re: Problem cloning essential theme

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Take the essentials child theme that Gareth includes in Essential, clone and rename it as many times as you need. Each renamed clone will function independently of the others as its own child of Essential.

In reply to Richard Oelmann

Re: Problem cloning essential theme

by Sheila Owen -

Cool. Thank you Richard!

In reply to Sheila Owen

Re: Problem cloning essential theme

by Sheila Owen -

I've managed to create an Essentials child theme. However, I'd like to change some of the colour variables. It would be good if the Essentials theme editor allowed you to change colours, ie admin > theme > essentials > colours. But it only has 'general'.

Another idea would be to use the Essential alternative colours for the child themes. But I don't know how I could do this.

My last resort is to create a 'variables.less' file in each of my child themes? If I do, what .less files do I need to @include from Essental theme to compile it correctly?

Thank you in advance for your help smile


In reply to Sheila Owen

Re: Problem cloning essential theme

by Sheila Owen -

I think I've solved the colours problem by adding colours to the settings.php file in my child theme.

Seems to be working ok.

In reply to Mari Cruz García

Re: Problem cloning essential theme

by Malcolm Hay -

Hi Mari,

I would be very interested in the steps you took to implement the Essential theme child, Essentials.

I am new to Moodle and have had a near vertical learning curve in the last nine months. 

We recently installed Essential as the Institution-wide theme and I am investigating using child themes as a way of giving departments the opportunity to put their own stamp on their courses but maintain consistency within programmes and offer a 'look and feel' at course theme level.

Regards,

Malcolm

In reply to Malcolm Hay

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Malcolm,

I have updated and improved the child theme mechanism in Essential and thus the template that was supplied with the theme no longer works.  Therefore even if Mari supplied the code it would fail in the latest versions.  So I would not wish for you to be frustrated as such.  For business reasons I have placed the updated child template in a private repository and it is no longer a sub-folder of the main public theme.

Kind regards,

Gareth

Average of ratings: Useful (1)
In reply to Gareth J Barnard

Re: Problem cloning essential theme

by Malcolm Hay -

Hi Gareth,

Thanks for your reply. We have several departments that have a distinctive style for their courses and we are trying to allow them to move away from the templates they are currently using which are fragile and break easily due to the minimal HTML knowledge of some of the tutors. 

While we are up-skilling staff as fast as possible, we still wish for them to be able to edit in an environment that is less fragile and less restrictive. We are thinking that we create a custom theme with their colours and styles which they can select at course level.

Would you recommend a clone or a child of essential?

Secondly, does 'for business reasons' mean that the child is no longer available or .... no longer available for free?

Cheers,

Malcolm

In reply to Malcolm Hay

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Malcolm,

RE: Would you recommend a clone or a child of essential? - child.  A clone would take ages, be difficult and then a lot of effort to maintain with the changes to the main Essential theme.  Have a go at cloning the theme to see what I mean.

RE: Secondly, does 'for business reasons' mean that the child is no longer available or .... no longer available for free? - the latter.

Kind regards,

Gareth

In reply to Gareth J Barnard

Re: Problem cloning essential theme

by Malcolm Hay -

Hi Gareth,

I appreciate the time you take to answer these forum posts.

Regarding the essential child:

1. Does this allow a similar level of customisation to the parent theme? i.e. is it editable in the site administration/appearance/themes?

2. What are the costs involved? How do you structure your services?

If a child is not the best solution to our situation, how would you suggest we create multiple instances of the theme on the one server to accommodate our departments?

Once again, many thanks for your help, so far.

Regards,

Malcolm

In reply to Malcolm Hay

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Malcolm,

RE:

1. Yes.

2. By the hour / half day / day or negotiated fixed price.

Last point with multiples and your departments: This is a site specific generic question and thus subject to remunerated consultancy.

Kind regards,

Gareth

In reply to Gareth J Barnard

Re: Problem cloning essential theme

by Malcolm Hay -

Hi Gareth,

Richard is probably right. The next steps should probably be direct. It is early days yet and we are still sorting out a Moodle upgrade, a change of theme and a change in direction form marketing and juggling that with an institution upheaval but I agree that at some stage soon we should seriously look at some targeted help.

My email:

mhay2@unitec.ac.nz

Regards,

Malcolm

In reply to Malcolm Hay

Re: Problem cloning essential theme

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Malcolm,

Please do contact me if you would like my help in the future.

Kind regards,

Gareth

In reply to Gareth J Barnard

Re: Problem cloning essential theme

by Malcolm Hay -

Hi Gareth,

I will do that. In the meantime, I will keep plodding away at the list of wishes from various teachers and departments - sorting into categories: reasonable, unreasonable, eutopian, of which there are a fair few smile

Cheers,

Malcolm

In reply to Malcolm Hay

Re: Problem cloning essential theme

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Malcom,

i know Gareth will be able to help you and will support the child theme if you take up his offer (and it really is the best way to get the support you want for a large 'Essential family' smile ), but in order to ensure consistency across all forum users, I'd suggest taking further discussion off forum and contacting him via PM. (You may have already done that/decided to do so)

No rules broken at all! Just a suggestion for continuing the conversation from this point forward in order to allow us to ensure that other more 'commercial' entities who use the forum don't try and twist things and take advantage in the future smile

Richard

In reply to Richard Oelmann

Re: Problem cloning essential theme

by Malcolm Hay -

Hi Richard,

Point taken. My questions were just for clarification at this stage.

Nice to finally meet you. I was told by an ex-colleague, that I would run into you and Mary if I spent any time at all in the forums.

Regards,

Malcolm

Average of ratings: Useful (1)
In reply to Malcolm Hay

Re: Problem cloning essential theme

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

'just for clarification at this stage' - Yep I realised that, hence the suggestion now rather than having to remove posts later on, or as I said, more likely having to moderate other people's posts later on as I know Gareth would make the same suggestion to you anyway smile

Ex-colleague? Aukland? Hmm, likely to be one of a fairly small group of people then smile And yes, along with Gareth, if you spend more than a few hours on the themes forum, you are bound to run into one, or both, of us fairly quickly smile

Richard

In reply to Richard Oelmann

Re: Problem cloning essential theme

by Malcolm Hay -

Hi Richard,

I started at Unitec just as Miriam was leaving. She was a goldmine of information and although I tried to download as much of her brain as I could in the short time we had together, it still left me with a near vertical learning curve for Moodle, which, up to that point, I had only dabbled in. Loving it, though.

Cheers,

Malcolm

Average of ratings: Useful (1)
In reply to Malcolm Hay

Re: Problem cloning essential theme

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

Umm...are you talking about me or Mary Cooch?

Hi Malcolm,

There is perhaps a way you could make a theme that looks like Essential but be a child of Bootstrapbase that way it would be much easier to get a load of minimalist child themes for your various departments..

What I am getting at is that you could simplify the structure...remove the settings you don't need. In fact you could probably start off with Aardvark and add settings from Essential into it, as there is a similarity in the look of Aardvark.

Being a Leo I'm just throwing a few ideas into the arena...grrr

Cheers

Mary

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

Re: Problem cloning essential theme

by Malcolm Hay -
Hi Mary,

I was, indeed, referring to you  smile

Your suggestion is well worth looking into as the individual departments do not require the full functionality of Essential. I will give it a go and get back to you. Thamks for all your help

Cheers,

Malcolm

In reply to Malcolm Hay

Re: Problem cloning essential theme

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

There may also be another option - depending on the level of customisation, or access to settings, each department requires - which has just been asked in another thread

https://moodle.org/mod/forum/discuss.php?d=331244#p1333401

In reply to Richard Oelmann

Re: Problem cloning essential theme

by Malcolm Hay -

Thanks for that, RIchard.  It has given me a lot to go on with. I am currently playing with Mary's suggestion regarding Aardvark. Not sure about it yet but it is easy to clone and create child themes.

Regards,

Malcolm

In reply to Gareth J Barnard

Re: Problem cloning essential theme

by Sheila Owen -

Aha! So maybe that's why my latest child theme didn't work?

I managed to create 2 or 3 a few months ago, with the help of Gareth's "Essentials" child theme. But when I tried to create a child theme to a later Essential version, it didn't work.

Is there anywhere we can get Gareth's revised "Essentials" theme?


In reply to Sheila Owen

Re: Problem cloning essential theme

by Malcolm Hay -

I think the answer to that lies in the answer Gareth gave to one of my previous posts.  https://moodle.org/mod/forum/discuss.php?d=322405#p1332650

Due to the enormous amount of time and energy required to update and maintain this code, he now, quite understandably, charges a fee for this service.

Mary Evans and Richard Oelmann both made some interesting suggestions for free alternatives/substitutes in some of the later posts.

Hope this helps.

Malcolm

In reply to Malcolm Hay

Re: Problem cloning essential theme

by Mari Cruz García -

Hello Malcom,

Sorry, I didn´t see your pòst until now. I am happy sharing with you my child theme (I will check that the link in Dropbox is working). However, it is better that you follow Gareth´s advise as, if he has made modifications in the code, the child theme will not work in the new version.


Regards,

Mari Cruz

Average of ratings: Useful (1)
In reply to Mari Cruz García

Re: Problem cloning essential theme

by Malcolm Hay -

Hi Mari,

It seems that there is an upgrade to the installation as I am running the new version.

Thanks for replying so quickly. I will follow Gareth's advice.


Kind regards,

Malcolm