3

I wanted to display a comment block below the activity rather than on the left or right side bars.

It was a lot easier than I thought.

I've added code for center-post which will add a block at the bottom of the main content. It could easily be modified to have a centre-pre for displaying at the top of the main content.

Russell England
  • 9,436
  • 1
  • 27
  • 41

1 Answers1

2

In /theme/yourthemename/config.php

Add 'centre-post' to the regions() array for each page layout where it is required. Eg for modules only added it to 'incourse' layout

 // Part of course, typical for modules - default page layout if $cm specifi
 'incourse' => array(
     'file' => 'general.php',
     'regions' => array('side-pre', 'side-post', 'center-post'),
     'defaultregion' => 'side-pre',
 ),

In /theme/yourthemename/lang/en/theme_yourthemename.php add

$string['region-center-post'] = 'Center Bottom';

In /theme/yourthemename/layout/general.php

near the top after $hassidepost ... add

$hascenterpost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('center-post', $OUTPUT));

then look for MAIN_CONTENT_TOKEN and add

<div class="region-content"> <?php echo core_renderer::MAIN_CONTENT_TOKEN ?> </div>
// Add this
<?php if ($hascenterpost) { ?>
<div id="region-center-post" class="block-region">
<div class="region-content">
<?php echo $OUTPUT->blocks_for_region('center-post'); ?>
</div>
</div>
<?php } ?>
// End of add this
<?php echo $coursecontentfooter; ?>

Now go to a module, add a block to the module and you will have a choice to move the block to the centre bottom.

Russell England
  • 9,436
  • 1
  • 27
  • 41