1
我想要在活動下方顯示評論塊,而不是在左側或右側邊欄上。如何將一個塊添加到Moodle中頁面的中心?
這比我想象的要容易得多。
我已經添加了中心帖子的代碼,它將在主要內容的底部添加一個塊。它可以很容易地修改爲在主要內容的頂部顯示中心預覽。
我想要在活動下方顯示評論塊,而不是在左側或右側邊欄上。如何將一個塊添加到Moodle中頁面的中心?
這比我想象的要容易得多。
我已經添加了中心帖子的代碼,它將在主要內容的底部添加一個塊。它可以很容易地修改爲在主要內容的頂部顯示中心預覽。
在/theme/yourthemename/config.php
添加「中心柱」與區域()陣列用於其中要求每個頁面佈局。例如,對於僅模塊把它添加到 'incourse' 佈局
// 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',
),
在/theme/yourthemename/lang/en/theme_yourthemename.php添加
$string['region-center-post'] = 'Center Bottom';
在/theme/yourthemename/layout/general.php
近$ hassidepost後頂部...添加
$hascenterpost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('center-post', $OUTPUT));
然後尋找MAIN_CONTENT_TOKEN並添加
<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; ?>
現在轉到模塊,將模塊添加到模塊,您可以選擇將模塊移動到中心底部。