0

i am working on moodle 2.8 and essential theme now i want to set my home page to show the forum topics . from frontpage.php in render folder i can see that they used get_setting funtion to render items but i cant find where and how to use this function to show the forum page in home page by the way i duplicated the code which renders the home page but i guess that my argomans are not true so this get setting is not working and now showing any thing ty in advance `

if ($showfrontcontent) { ?>
            <div class="frontpagecontent">
                <?php
                echo $OUTPUT->get_setting('frontcontentarea', 'format_html');
                echo $OUTPUT->get_setting('mod_forum', 'format_html');
                echo $OUTPUT->essential_edit_button('theme_essential_frontpage');
                ?>

            </div>`
Farshad
  • 1,830
  • 6
  • 38
  • 70

1 Answers1

0

An easy way to do this, and should be created as a default in Moodle in my humble opinion, is to create a centre region in the frontpage layout.

Then when you add a block (with your forum topics code) to the front page, just move it to the centre region.

Here is how to create the region :

in /theme/themename/config.php add 'center-post' to regions for the frontpage.

 'frontpage' => array(
     'file' => 'default.php',
     'regions' => array('side-pre', 'side-post', 'center-post'),
     'defaultregion' => 'side-pre',
     'options' => array('langmenu'=>true),
 ),

in /theme/themename/lang/en/theme_themename.php add a string for the region name

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

in /theme/themename/layout/default.php add the $hasscenterpost line:

$hassidepost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-post', $OUTPUT));
// Add this line.
$hascenterpost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('center-post', $OUTPUT));
$haslogininfo = (empty($PAGE->layout_options['nologininfo']));

Then after the region-content div, add the if ($hascenterpost) code:

<div id="region-main">
    <div class="region-content">
        <?php echo $coursecontentheader; ?>
        <?php echo $OUTPUT->main_content() ?>
        <?php echo $coursecontentfooter; ?>
    </div>
    <?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 } ?>
</div>

You will probably need to increment the version number in /theme/themename/version.php too.

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