【问题标题】:How to add a block to the center of a page in Moodle?如何在 Moodle 的页面中心添加一个块?
【发布时间】:2014-05-19 23:45:25
【问题描述】:

我想在活动下方而不是在左侧或右侧栏上显示评论块。

这比我想象的要容易得多。

我为 center-post 添加了代码,它将在主要内容的底部添加一个块。它可以很容易地修改为在主要内容的顶部显示一个 center-pre。

【问题讨论】:

    标签: moodle


    【解决方案1】:

    在 /theme/yourthemename/config.php 中

    在需要的每个页面布局的区域()数组中添加“中心帖子”。例如,模块仅将其添加到“课程”布局中

     // 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; ?>
    

    现在转到一个模块,向模块添加一个块,您可以选择将块移动到底部的中心。

    【讨论】:

      猜你喜欢
      • 2021-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-25
      相关资源
      最近更新 更多