Removing top Navigation from One topic per page

Removing top Navigation from One topic per page

by William Mair -
Number of replies: 8

Hi,

I am trying to find the code that displays the Previous/Next topic names in the One Topic Per Page format so that I am left with just the current topic title and the navigation at the bottom only.

Can anyone point me in the direction of where the code is?

Thanks

Average of ratings: -
In reply to William Mair

Re: Removing top Navigation from One topic per page

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

Dear William,

You will find the code in the method 'print_single_section_page()' in the file '/course/format/renderer.php' which will be for all course formats unless they have overridden the method.  I would recommend overriding it in a custom format for testing before a core hack that you need to maintain.

Cheers,

Gareth

In reply to Gareth J Barnard

Re: Removing top Navigation from One topic per page

by Marina Glancy -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi William

you can override it also in your theme but don't forget that you should extend format_topic_renderer (or format_weeks_renderer) and NOT format_sections_renderer_base

In reply to William Mair

Re: Removing top Navigation from One topic per page

by Peter Kowski -

Before playing around with the code, you can always hide it using a bit of css. Probably something as simple as:

.course-content .single-section .section-navigation {
    display: none;
}

Your theme might well have an additional css field (on the theme settings page), or you can add it directly to one of the style sheets in the style folder of your theme.

In reply to Peter Kowski

Re: Removing top Navigation from One topic per page

by William Mair -

For anyone else wanting to do the same, the above would have hidden the navigation both top and bottom.

I managed to get around the removing top only by adding the following to my css

.header a {display:none}

In reply to William Mair

Re: Removing top Navigation from One topic per page

by Marina Glancy -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

another option:

body {display: none}

Average of ratings: Useful (1)
In reply to Marina Glancy

Re: Removing top Navigation from One topic per page

by Peter Kowski -

The best tool for hiding things in css is the firebug plugin for firefox. That way you can click on elements of the page, find out what style is controlling it and then try out your css changes inline.

In reply to Peter Kowski

Re: Removing top Navigation from One topic per page

by Dominic Jones -

or the chrome web developer tools smile

In reply to Dominic Jones

Re: Removing top Navigation from One topic per page

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

Dear all,

Developer tools like Firebug and Chrome developer tools are great for finding what is going on, but they are not the long term solution.

The long term solution is to either patch the existing code (maintainance issue on upgrade) as I suggest or better, Marina's solution of extending parent classes.

Has nobody spotted the irony of:

body {display: none}

? smile

Cheers,

Gareth