Resources in MVC in PHP

When developing a website, some resources accessible via a direct link are required. These are CSS files, JavaScript files, images, and more. For such things, our framework has a folder /project/webroot/. Everything placed in this folder will be accessible via a direct link.

Let's, for example, connect a CSS file to our site. Let the name of this file be styles.css. Place this file in the webroot folder and connect it as follows:

/project/layouts/default.php<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="/project/webroot/styles.css">
    <title><?= $title ?></title>
  </head>
  <body>
    ...
  </body>
</html>
Задание 1

Connect some CSS file to your site. Check its functionality.

Задание 2

Place some image on your site. Check that it displays correctly on the site page.