1

For those on Windows / Here we set up Laragon for convenient PHP development

2

FOR LINUX AND MAC USERS / Configuring PHP for local development (how to configure it on a production server, or if you want to tinker with nginx, see the module on vps)

3

Let’s figure out how to process simple web requests and make a simple multi-page website.

Before you start this task, you need to come up with a theme for your website.

It could be characters, movies, music, instruments, cars, trees, flowers—whatever you like. The main thing is that you can match an image and some kind of description to this object. For now, two examples of your theme will suffice.

I chose the theme of cosmic nebulae. My test subjects are the Andromeda Galaxy and the Orion Nebula.

4

Revise the website:

  1. Add additional pages with information about the object and a picture of the object.
  2. Create separate files for the new pages, which will be linked from the object page.
  3. Add links to all pages on the home page.
  4. The additional pages should show which menu item is selected.

The result should look something like this:

5

We connect the Twig template engine to work with markup more competently.

6

Refine your application by implementing controllers for all pages.

7

Rewrite the website from task 2 using Twig

  • There must be at least two basic template templates, with a total of about 6 templates
    • general template
    • for the main page (inherits from the general template),
  • for the object page (inherits from the general template),
  • for the page with the object image (inherits from the object template)
  • and for the page with information about the first instance of the object (inherits from the object template)
    • and for the page with information about the second instance of the object (inherits the object template)
  • Use a loop to display menu items on the main page
  • [optional] Use a loop to display items in the navigation
8

Implement a macro to display a button in an active state. Macro call interface:

{{ btn("Button text", "url", true, "warning") }}

should generate the following markup

<a href="url" class="btn btn-warning">Button text</a>

if the third parameter is false, then display

<a href="url" class="btn btn-link">Button text</a>

if the fourth parameter is not specified, then for {{ btn("Text on button", "url", true) }} display a button in the primary style

<a href="url" class="btn btn-primary">Text on button</a>

Display the button using a macro in all places in your application where the button is displayed.

Create a sub-template for the list element on the main page and connect it using include.

Examples of working with include and macro can be found in the documentation [https://twig.symfony.com/doc/3.x/tags/include.html] (https://twig.symfony.com/doc/3.x/tags/include.html) and https://twig.symfony.com/doc/3.x/tags/macro.html