Blocks in the center region - Moodle 2.0

Blocks in the center region - Moodle 2.0

Monica Soori -
Atsakymų skaičius: 7

I believe moodle 2.0 supports blocks to be added to the center region. I am not able to find good documentation on this topic.

Once I log in , I want to have a block displayed in the course/categories list section in the center to show my custom block. Pl suggest.

Įvertinimų vidurkis: -
Atsakymas į Monica Soori

Re: Blocks in the center region - Moodle 2.0

Mary Cooch -
Documentation writers paveikslėlis Moodle HQ paveikslėlis Particularly helpful Moodlers paveikslėlis Testers paveikslėlis Translators paveikslėlis
Erm- I am not sure about this; I will go and check it out. Could you clarify a bit more what you mean and maybe there is a workaround or something already possible?
(edit) Ok -back besišypsantis At present centre blocks are only available on the MyMoodle page in Moodle 2.0. Would that help?
Priedas centreblocks2.png
Atsakymas į Mary Cooch

Re: Blocks in the center region - Moodle 2.0

Tim Hunt -
Core developers paveikslėlis Documentation writers paveikslėlis Particularly helpful Moodlers paveikslėlis Peer reviewers paveikslėlis Plugin developers paveikslėlis
Actually, "Where can blocks go on the page?" is a decision that is up to the theme you use. However, I don't think anyone has yet made a theme that offers anything other than left and right. Perhaps the Moodle 2.0 theme competition will encourage someone to be creative?

In addition, as you spotted, certain pages can choose to make extra regions visible. My hope was that some other pages, like the site front page, and the category pages, would let you customise the contents by putting any blocks you like in the middle, but I don't think that has been implemented. (What really needs to be duplicated are blocks that replicate what currently goes in the middle of those pages, so we can use those blocks instead of the current code.
Atsakymas į Mary Cooch

Re: Blocks in the center region - Moodle 2.0

franziss franziss -

I am trying to add a block "question" which I have created, to the center of my moodle page. But my block "question" is not shown under the "Add a block" of my moodle page

Why is it so? My block "question" is allowed to be added under the course and main moodle page.

Atsakymas į franziss franziss

Re: Blocks in the center region - Moodle 2.0

Mary Evans -
Core developers paveikslėlis Documentation writers paveikslėlis Peer reviewers paveikslėlis Plugin developers paveikslėlis Testers paveikslėlis

There is not much you can do with a block, if you can move it then you are restricted to only the areas indicated in Mary Cooch's comment earlier in this discussion. In your case you can only move the block within the course you created it in. You cannot reasign it to a new location. Neither will it show up in the Add Block dropdown list.

Mary

Atsakymas į Mary Evans

Re: Blocks in the center region - Moodle 2.0

franziss franziss -

Thank you for your reply Mary. Is there a simple way to place a block in the center of the page? I read somewhere that some themes support this. Do you have any idea which themes allow this? Thank you for your kind help.

Atsakymas į franziss franziss

Re: Blocks in the center region - Moodle 2.0

Guy Thomas -
Core developers paveikslėlis Plugin developers paveikslėlis

Any theme can be easily modified to allow for blocks to be placed in the main region of the front page. This is what I did to modify the standard them to work this way:

Step 1 - Modify [yourtheme]/layout/general.php

put <?php echo $OUTPUT->blocks_for_region('main') ?> under <?php echo $OUTPUT->main_content() ?>

e.g.

                <div id="region-main-wrap">
                    <div id="region-main">
                        <div class="region-content">
                            <?php echo $OUTPUT->main_content() ?>
                            <?php echo $OUTPUT->blocks_for_region('main') ?>
                        </div>
                    </div>
                </div>

Step 2 - Modify [yourtheme]/config.php

// apply same layout to each possible layout type
$layouts=array('standard','course','coursecategory','incourse','frontpage','admin','mydashboard','mypublic','popup','frametop','embedded','maintenance','print');
foreach ($layouts as $layout){
    $THEME->layouts[$layout]= array(
        'file' => 'general.php',
        'regions' => array('side-post','main'),
        'defaultregion' => 'side-post',
    );
}

Atsakymas į Guy Thomas

Re: Blocks in the center region - Moodle 2.0

Mary Evans -
Core developers paveikslėlis Documentation writers paveikslėlis Peer reviewers paveikslėlis Plugin developers paveikslėlis Testers paveikslėlis

Thanks for updating that post Guy, but you missed off some other important things too like...

$hasregionmain = $PAGE->blocks->region_has_content('main', $OUTPUT);

in theme/themename/layout/frontpage.php, general.php and report.php

and also...

$string['regionmain'] = 'Center';

which needs adding to theme/themname/lang/en/theme_themename.php

Cheers

Mary