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

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

by chaya 1234 -
Number of replies: 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.

Average of ratings: -
In reply to chaya 1234

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

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of 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