Elegance theme with Essential Footer

Elegance theme with Essential Footer

by Finton Paul -
Number of replies: 11

Hi everyone

happy new year to everyone.

I would like to use the Elegance theme but would like to use the three (3) areas in the footer to add blocks. Is there a way that can be achieved? If so, can someone send me the code that I can copy and paste and indicate into which file and at what location it has to be inserted?

 I'm using Moodle2.7.2 (Build: 20140908) and Essential theme released on Dec. 25, 2014 (Essential 2.7.9.4.3 (Build: 2014111007) and the Elegance theme that is most recent in the Themes area.

Average of ratings: -
In reply to Finton Paul

Re: Elegance theme with Essential Footer

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

This works ...

  1. ADD this mark-up to the page-footer of your themes frontpage layout (check elegance/config.php for guidence)
    <div class="row">
        <div class="col-sm-4">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3 class="panel-title">Footer Blocks (Left)</h3>
            </div>
            <div class="panel-body">
               <?php echo $OUTPUT->blocks('foot-pre'); ?>
            </div>
          </div>
        </div><!-- /.col-sm-4 -->
        <div class="col-sm-4">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3 class="panel-title">Footer Blocks (Middle)</h3>
            </div>
            <div class="panel-body">
              <?php echo $OUTPUT->blocks('foot-mid'); ?>
            </div>
          </div>
        </div><!-- /.col-sm-4 -->
        <div class="col-sm-4">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3 class="panel-title">Footer Blocks (Right)</h3>
            </div>
            <div class="panel-body">
              <?php echo $OUTPUT->blocks('foot-post'); ?>
            </div>
          </div>
        </div><!-- /.col-sm-4 -->
    </div>

2. Add relevant $strings for footer left/middle/right in elegance/lang/en

$string['region-foot-pre'] = 'Ft-Left';
$string['region-foot-mid'] = 'Ft-Mid';
$string['region-foot-post'] = 'Ft-Right';

3. Add these three new block regions to elegance /config.php within the $THEMES->layouts where you see...

    // The site home page.    
    'frontpage' => array(
        'file' => 'default.php',
        'regions' => array('side-post', 'side-middle ', 'hidden-dock', 'foot-pre', 'foot-mid', 'foot-post'),
        'defaultregion' => 'foot-mid',  
        'options' => array('nonavbar' => true),        
    ),

By the way this is an alternative, and one which is pertinent to Bootstrap Version 3 which is what Elegance is.

It uses panel css, which is part of Bootstrp 3, and as I am using the same in a theme I am making I thought this may be of interest to you. My theme uses block renderers, but it's not for show at this moment in time, however this is a simple alternative. It also means you can add your own titles to the panel header, since you are delving into coding. smile

If you get stuck give me a shout.

Cheers & Happy New Year!

Mary

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

Re: Elegance theme with Essential Footer

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

Hi Mary,

Is foot-mid supposed to be there twice?

You seem to have two rows - one with side-pre; foot-mid; side-post and the other with foot-pre;foot-mid;foot-post

R

In reply to Richard Oelmann

Re: Elegance theme with Essential Footer

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

Thanks Richard...it looks like it mush have been duplicated when I was having some problems with the text editor. I remember adding the code and editing it, then saving it and then going back to adjust something.

I'll fix it now.

Cheers

Mary

In reply to Mary Evans

Re: Elegance theme with Essential Footer

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

There is a syntax error as 'defaultregion' appears to be in the 'regions' array.  Should be:

'frontpage' => array(
    'file' => 'frontpage.php',
    'regions' => array('side-post', 'foot-pre', 'foot-mid', 'foot-post', 'side-middle', 'hidden-dock'),
    'defaultregion' => 'side-post',
    'options' => array('nonavbar'=>false),
),
In reply to Gareth J Barnard

Re: Elegance theme with Essential Footer

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

Thanks Gareth, I've amended it now.

In reply to Mary Evans

Re: Elegance theme with Essential Footer

by Finton Paul -

Hi Mary

Thanks for your help. I've managed to add 2 out of the 3 bits of code as per your guidance (including the correction posted underneath). However, I am unable place the code #1 as posted by you above.

Actually, I tried adding it frontpage.php and alternatively to footer.php but even with the blocks showing up on the front page, the areas are just solid. Nothing can be added there. In fact, even trying to configure  a new block do not even display the regions pertaining to the three areas.

I've sent you copies of my essential frontpage and footer files. Don't know if that will help.

Footer Blocks


In reply to Finton Paul

Re: Elegance theme with Essential Footer

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

Have you turned editing on? When you do the middle block displays the 'Add a block' a from there you should either be able to add a block and configure it so as to be associated with that block region and then Drag n Drop it into that region. or do the same with other blocks already created.

In reply to Mary Evans

Re: Elegance theme with Essential Footer

by Jamie Burgess -

Hi Mary,

I have this working pretty nicely, have added the regions to all pages and content can be added without issue, but the content is not showing up on the front page when not logged in. Is there anything I'm missing here? I have the content set to display everywhere on the site, and the permissions allow guests, but it's still not showing up sad


In reply to Jamie Burgess

Re: Elegance theme with Essential Footer

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

Did you add the those changes to frontpage.php?

In reply to Mary Evans

Re: Elegance theme with Essential Footer

by Jamie Burgess -

I added the code snippet #1 (above) to the includes/footer.php rather than frontpage.php and the added content (system context level - set to show throughout the entire site) only shows up after logging in, and not before logging in. Having said that, the regions themselves appear to show up before logging in (http://elearning.aerpi.edu.au/login/index.php).

I also added the $strings to the language file and the new block regions to the config file ( I have attached the edited files).

What could be wrong?


In reply to Jamie Burgess

Re: Elegance theme with Essential Footer

by Jamie Burgess -

Got it! forcelogin was set to "yes" - this was preventing any content from displaying before login.

big grin