Moodle删除自定义主题首页的内容


Moodle remove content in front page of custome theme

我正在尝试为moodle开发一个自定义主题。我已经按照教程中的说明进行了操作https://docs.moodle.org/dev/Creating_a_theme自定义首页。在首页,我不想显示moodle的内容。所以我尝试删除core_renderer::MAIN_CONTENT_TOKEN,然后它显示错误

Coding error detected, it must be fixed by a programmer: page layout file [dirroot]/theme/mentornetz/layout/frontpage.php does not contain the main content placeholder, please include "<?php echo $OUTPUT->main_content() ?>" in theme layout file? 

如何删除内容而不显示错误。

显然,您无法避免调用main_content()函数。

main_content()函数打印如下字符串:

<div role="main">[MAIN CONTENT GOES HERE - W6ATMmqMgo]</div>

Moodle在其中注入其(主要区域)内容。

事实是,如果你想创建一个新的主题,Moodle必须在某个地方注入其动态内容。否则,根本不需要Moodle:-)

然而,你能做的是:

  • 在此行上方和(或下方)定义一些自定义内容(即在内容区域上方或下方)。或者
  • 只需定义一个静态页面,与Moodle内容完全无关

如果需要,也可以覆盖main_content()函数。有关详细信息,请参阅此问题的第一个答案。