将自定义 CSS 添加到新的 Moodle 作业中
我正在开发一个新的 Moodle 分配插件。 如何将自定义 CSS 添加到我的插件中? 我正在使用 Moodle 1.9.7。
提前致谢。
I'm working on a new Moodle Assignment plugin.
How can I include a custom CSS to my plugin?
I'm using Moodle 1.9.7.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需将一个名为 styles.php 的文件添加到模块的文件夹中即可。
该文件在解析时应输出 CSS 代码。
当构建页面的 CSS 布局时,Moodle 会进入每个模块的文件夹并查找该文件。
某些主题可以使用主题的 config.php 文件中的特殊设置来忽略这些文件,
这里是此 styles.php 文件内容的简短示例:
just add a file called styles.php into the Module's folder.
the file should output CSS code when it is parsed.
Moodle goes into each Module's folder and looks for that file, when the page's CSS layout is constructed.
Some themes can ignore these files using a special setting in the theme's config.php file
here is a short sample of what could be the content of this styles.php file:
也许可以看看
lib/weblib.php
中定义的function print_header_simple()
。如果您正在编写一个生成模块特定页面的模块,并且它们使用普通的 Moodle 库,则将
$meta
中的内容添加到部分,同时正在生成页面。
在
lib/weblib.php
中:这意味着您可能希望在模块中包含如下内容:
Perhaps could take a look at the
function print_header_simple()
defined inlib/weblib.php
.If you are writing a module which generates module specific pages, and they use the normal moodle libraries then stick something in
$meta
to be added to the<head>
section while the page is being generated.in
lib/weblib.php
:This means that you probably want something like the following in your module: