[3/9] - Beginners Symfony 4 Tutorial - Let Twig Do The Hard Work

Описание к видео [3/9] - Beginners Symfony 4 Tutorial - Let Twig Do The Hard Work

Watch the full video and find the code - https://codereviewvideos.com/course/s...

In the previous video we created (technically: generated) our first Controller class, along with a single controller method which rendered and returned our index.html.twig template.

Keeping things simple, we put everything inside the templates/welcome/index.html.twig template. In doing so, we created a nice looking web page for the root of our site (/), but when visiting our other route (/hello), we saw a basic, unstyled page.

What we don't want to have to do is copy / paste all of the layout and navbar from one template to another, every time we make a new template, or update an existing one. This would be a bad time.

Instead, what we're going to do is to extract out these common parts of our layout, and then create blocks that we can fill in on a per page basis. It's much easier to see in practice, so let's dive right in.

Комментарии

Информация по комментариям в разработке