From 49338c31b5016aa5df6514857d6af391dd9d6df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20P=C5=82aczek?= Date: Thu, 17 Oct 2024 17:03:52 +0200 Subject: [PATCH] Splitting twig files into multiple and using template inheritance. --- templates/base.html.twig | 16 ++++++++++++++++ templates/main/homepage.html.twig | 19 +++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 templates/base.html.twig diff --git a/templates/base.html.twig b/templates/base.html.twig new file mode 100644 index 0000000..b199509 --- /dev/null +++ b/templates/base.html.twig @@ -0,0 +1,16 @@ + + + + + {% block title %}Welcome!{% endblock %} + + {% block stylesheets %} + {% endblock %} + + {% block javascripts %} + {% endblock %} + + + {% block body %}{% endblock %} + + diff --git a/templates/main/homepage.html.twig b/templates/main/homepage.html.twig index 84e3b0a..9c6ef23 100644 --- a/templates/main/homepage.html.twig +++ b/templates/main/homepage.html.twig @@ -1,18 +1,5 @@ - - - - - {% block title %}Welcome!{% endblock %} - - {% block stylesheets %} - {% endblock %} - - {% block javascripts %} - {% endblock %} - - - {% block body %}{% endblock %} +{% extends "base.html.twig" %} +{% block body %} {{ variable }} - - +{% endblock %}