How can i set the $PAGE->requires in moodle 2.2 ? I want to set CSS for the page ,what should I do ?
I wonder if this is what you mean, though? It would help if you gave a little background about what you are trying to do?
With moderator hat on... I understand that english is probably not your first language but your (many) questions are impossible to answer without some basic information. If something doesn't work...
- what did you do?
- what did you expect?
- what happened?
I have defined a CSS in moodle 1.9 and it can work normally.But when I imigrate the plugin to moodle 2.2 ,the page can not be shown incorrectly. So i think the CSS in moodle 2.2 had been changed or the method of use CSS in moodle 2.2 is different from 1.9 . When i use print_header() I need $meta,but when I use $OUTPUT->header(),how can I make use of $meta;$meta is related to CSS and javascript.
Sorry ,I have not . Can you give me a link ?
I think there is something i have not clarified;I just want my css to work in my plugin.
what i want to know is how can I set css such as "<link rel="stylesheet" type="text/css" href="http://localhost:8881/moodle/theme/yui_combo.php?2.9.0/build/assets/skins/sam/skin.css" />" in moodle 2.2 ? In moodle 1.9 I can do it by pass $meta to print_header();But how can I do it in moodle 2.2.
If you want css in Moodle 2.x, put it in a file called 'styles.css', within your block's main folder and it will be included.
To complete Davo's correct response:
The stylesheets pertaining to a plugin are placed inside that plugin's folder and called:
in moodle 1.9: styles.php
in moodle 2.x: styles.css (logically )
Joseph
Site admin > developer > purge caches, then your CSS will be automatically included (usually it is included whenever your plugin's version number changes).
I think there is something i have not clarified;I just want my css to work in my plugin.
what i want to know is how can I set css such as "<link rel="stylesheet" type="text/css" href="http://localhost:8881/moodle/theme/yui_combo.php?2.9.0/build/assets/skins/sam/skin.css" />" in moodle 2.2 ? In moodle 1.9 I can do it by pass $meta to print_header();But how can I do it in moodle 2.2.
I have done as you said. In moodle 1.9 set css by $CFG->stylesheets[] = $CFG->wwwroot.'/mod/programming/styles.css'; In moodle 2.2 is it do this atuomatically by system ,when I do as you said ?
ok , Thanks