$PAGE->requires->css() not work;

$PAGE->requires->css() not work;

av chaya 1234 -
Antall svar: 1

Hello,

I have a problem. in my local I added a index.php page. In this page I want to add a css file.

I wrote: 

$PAGE->requires->css(__DIR__ . '/style/style.css'); 

But in the network of F12 I give error 404 - the page not found. 

The path is correct.

What can be the problem?

Thanks.

Gjennomsnittlig vurdering: -
Som svar til chaya 1234

Re: $PAGE->requires->css() not work;

av Renaat Debleu -
Bilde av Core developers Bilde av Particularly helpful Moodlers Bilde av Plugin developers
Hi Chaya,

the path is not correct: __DIR__ . '/style/style.css refers to a relative path.
Use a absolute path using $CFG->dirroot/???/style/style.css

R