Override parent header with child header moodle 3.2.2

Override parent header with child header moodle 3.2.2

by vysakh b -
Number of replies: 23

Hi Moodlers


I have created a new custom theme. In theme config file I have given

$THEME->parents = array('eduhub','clean', 'bootstrapbase');

How can I override the parent theme header with the new header i have created in the custom theme.


Thanks In advance

Regards

Vysakh

Average of ratings: -
In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Moving to Themes forum...

In reply to Howard Miller

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Ok sure

Thanks

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

Hi,

To save me asking you a hundred questions about your new theme can you tell me simply if you have a layout directory and the necessary files for your new theme that have the same layout filesnames as the eduhub, clean and bootstrapbase themes?

Thanks

Mary

In reply to Mary Evans

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Hello Mary,


Yes we have a layout folder which contains header.php, footer.php and frontpage.php.

Whether i need to add the column1.php,column2.php and column3.php


Thanks & Regards

Vysakh

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Hello Mary,


Thanks for your reply we have added rest all files in the theme folder and now its working fine.

But in quiz attempt page, quiz navigation block is not appearing. We tried by adding and removing the below code in theme config.php. Please help as to find a solution for this.

'secure' => array(

    'file' => 'secure.php',

    'regions' => array('side-pre', 'side-post'),

    'defaultregion' => 'side-pre'

),


Thanks in advance


Regards

Vysakh

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

The secure layout file is a special file and by design has little or no heading, there are no links as the page is supposed to be for examinations where students need to be locked into the page with no means of distractions.

Also because you have not described to me what changes you have done to your site, I can't really help.

it might help if you show me a screenshot of the header that in one shot looks the way you want it to look, and in the second shot as it looks now?

thanks

Mary

In reply to Mary Evans

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Hello Mary,

thanks for you reply.

We are sending the header.php file also along with this. 

We are not getting breadcrumbs and notification part. 

Please find the attached images

Thanks in advance

Breadcrumb and notification


Layout folder in my new theme folder


eduhub theme quiz page

custom theme quiz page


Regards 

Vysakh

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

Hi, 

Well after looking at the header.php I am not surprised its not doing what you want it to.

There are some better ways to code it if you use Moodles Coding Guidelines.

Can you email me the theme itself and I'll have a better chance of finding a solution.

email-addressremoved

Thanks

Mary

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

Hi,

Thanks for sending me the zip file of your theme.

I'll look at this later today and let you have some feedback...hopefully!

Cheers

Mary

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

OK...first bit of Feedback.

I don't see the required version.php for this theme, so how is this showing up in Moodle 3.2?  Technically it should not be working.

Also you have blocked some JavaScript files in the config.php, if this is to stop the files from working because you are using YUI JS in a js directory then this, again, is not really the Moodle way of doing things.

There are lots of places within the structure of your theme that could be causing it not to function as you want it to.

For a child of a child theme this is, sorry to say,  a really complicated set of bad coding.

You might as well have cloned EduHub theme and used that instead of creating a Frankenstein version of a theme!

Mary

In reply to Mary Evans

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Hello Mary,


Thanks for your reply

In eduhub theme version file is there attaching the same. It will be great if you let us know the solution for notification, breadcrumbs and quiz navigation bar.

Thanks in advance. It will be really helpful if we get a solution.


Regards

Vysakh 

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Hello Mary,


We have followed this link given below 

 https://docs.moodle.org/dev/Creating_a_theme#Theme_designer_mode

 and created one standard.php file in the layout folder, with the same config structure. We have created a folder name page in the root folder and created one file all_category.php (page/all_category).  But we are getting this error 

"Coding error detected, it must be fixed by a programmer: Invalid state passed to moodle_page::set_state. We are in state 0 and state 3 was requested."


I am sharing the all_category.php file. Please help me to find a solution for this


Thanks in advance


Regards

Vysakh


In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

Please see the very first lines of the page you say you have been following:

Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.

This document describes how to create a theme for Moodle 2.0 and Moodle 2.1. ONLY

So the first part of the solution would be to use the links on that page to read the upto date guidance - probably for 3.2 that you say you are using, i would recommend the Creating a Theme Based on Boost link - but the Themes Overview page should be your starting point.



In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

Hi Vysakh, 

You need to learn how to walk first before you can run...

Reading any documentations to do with themes is defiantly the wrong way, in your case, to go about things as Richard has kindly pointed out, that document is well out of date!

I was hoping to update/tidy up the theme you sent me, but looking at it and knowing you don't appear to have a clue what you are doing, is somewhat putting me off trying to help!

I am not sure what you are trying to do, with this last file, but up to now you are on your way to breaking Moodle, thus getting into a situation that you will not be able to get out if other than deleting the theme you are currently using.

Also if you have Theme Designer Mode on, then turn it off as its not doing any good at this stage.

Last but not the least...NEVER attempt to add directories to Moodle Root directory unless you know what you are doing.

Cheers

Mary

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

Hi Vysakh,

Here is some more feedback for you concerning the files you need:

All the files you need are the ones listed below in this part of your themes config.php

$THEME->layouts = array(
// The site home page.
        'frontpage' => array(
        'file' => 'frontpage.php',
        'regions' => array('side-post'),
        'defaultregion' => 'side-post',
        'options' => array('nonavbar' => true),
    ),
    'mypublic' => array(
        'file' => 'profile.php',
        'regions' => array('side-post'),
        'defaultregion' => 'side-post',
        'options' => array('nonavbar' => true),
    ),
    'embedded' => array(
        'file' => 'embedded.php',
        'regions' => array()
    ),
    'standard' => array(
    'file' => 'general.php',
    'regions' => array('side-pre', 'side-post'),
    'defaultregion' => 'side-pre'
    ),
    'login' => array(
        'file' => 'login.php',
        'regions' => array(),
        'options' => array('langmenu' => true),
    ),
    'signup' => array(
        'file' => 'signup.php',
        'regions' => array(),
        'options' => array('langmenu' => true),
    ),

You can remove all of the other files unless they are needed in the coding like the header.php?

Further to this feedback:

The classes/core_renderer.php can be deleted as it is an exact copy of the eduhub core_renderer.php and so no need to have it in you child theme, as it is inherited from the parent EduHub theme

However this is not so for the following{

classes/course_renderer.php has been changed from the original eduhub/classes/course_renderer.php

so you need to change the following line:

From:

class theme_eduhub_core_course_renderer extends core_course_renderer {

To:

class theme_bentam_core_course_renderer extends core_course_renderer {

After doing all this, then you need to Purge all caches

your moodle site URL.. /admin/purgecaches.php

HOPE THIS HELPS?

Cheers

Mary

In reply to Mary Evans

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Dear Mary,


Thanks for all your support. 

In our custom theme we have created responsive design and from admin we have selected the same theme for mobile view and tablet view. But when we load the website in mobile we are getting the same desktop view.

Please help to find a solution for this 


Thanks in advance


Regards

Vysakh


In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

Hi, 

Is the mobile an iPhone or an Android?

In reply to Mary Evans

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Hello Mary,


For both Android and iPhone and in tab


Thanks & Regards

Vysakh

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Hello Mary,


We have one file named media.css in our custom theme. We are calling that in config file like the code given below

$THEME->sheets = array('media', 'reset');

Please let us know any other solution is there.

Thanks in Advance


Regards

Vysakh

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

I am getting this notification:

!Notice: Undefined variable: regionmain in C:\wamp64\www\moodle32\theme\benten\layout\columns2.php on line 146 Call Stack #TimeMemoryFunctionLocation 10.0114365456{main}egg...\index.php:0 28.350010247568tool_installaddon_installer->handle_remote_requestegg...\index.php:43 321.801310257688tool_installaddon_renderer->remote_request_confirm_pageegg...\installer.php:189 421.801310257688core_renderer->headeregg...\renderer.php:143 521.832110222080core_renderer->render_page_layoutegg...\outputrenderers.php:1040 621.865110239488include( 'C:\wamp64\www\moodle32\theme\benten\layout\columns2.php' )...\outputrenderers.php:1110 ">

???

Mary

In reply to Mary Evans

Re: Override parent header with child header moodle 3.2.2

by vysakh b -

Dear Mary,


Shared the latest theme folder to your mail. Please update with new theme file and help me to find a solution for this

Thanks in advance


Regards

Vysakh

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

Hi Vysakh!

Unfortunatly I can't help you any further, as I do not have the time.

Sorry,

Mary

In reply to vysakh b

Re: Override parent header with child header moodle 3.2.2

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

Thank you for the theme update zip file.

Like I said in my last comment I am short of time and so cannot afford to spend more time with this theme as it is not helpful when it has more files in it that are not really needed if it is a child theme, as most things will be inherited from the parent theme/s.

What I did notice is that now you have two core_renderer.php files one in classes/core_renderer.php and one in renderers/core_renderer.php

This last one is called via the benton/renderers.php

So I get a feeling that this is why the headers are not working as you would like, this is becasue :

  1. You have two core_render.php files.
  2. You have a classes directory as well as renderers directory.

You should either stick to just using the classes or just use the renderers.php you do not need to use both methods.

If you remove both benton/renderers.php as well as the renderes directory and use the core_renderer.php which extends the Moodle core_renderer in place of the classes/core_renderer.php that extends the bootstraobase_renderer which is a direct copy of the EDUhub theme core_renderer.php

so your classes/ directory should have just two files in it...these are as follows!

  1. core_renderer.php taken from benton/renderers directory
  2. course_renderer.php

I hope this helps?

Mary