Add the Home page
This commit is contained in:
parent
559ed8e908
commit
cdb0e67eb3
17
src/Controller/BaseController.php
Normal file
17
src/Controller/BaseController.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Twig\Environment;
|
||||
|
||||
abstract class BaseController
|
||||
{
|
||||
protected Environment $twig;
|
||||
|
||||
public function __construct(Environment $twig)
|
||||
{
|
||||
$this->twig = $twig;
|
||||
}
|
||||
}
|
21
src/Controller/HomeController.php
Normal file
21
src/Controller/HomeController.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
final class HomeController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @Route("/", name="home")
|
||||
*/
|
||||
public function __invoke(): Response
|
||||
{
|
||||
$content = $this->twig->render('pages/home.html.twig');
|
||||
|
||||
return new Response($content);
|
||||
}
|
||||
}
|
5
templates/page.html.twig
Normal file
5
templates/page.html.twig
Normal file
|
@ -0,0 +1,5 @@
|
|||
{% extends 'html.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% block content %}{% endblock %}
|
||||
{% endblock %}
|
5
templates/pages/home.html.twig
Normal file
5
templates/pages/home.html.twig
Normal file
|
@ -0,0 +1,5 @@
|
|||
{% extends 'page.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
This is the homepage.
|
||||
{% endblock %}
|
Loading…
Reference in a new issue