Can't get title block to populate in Twig template using PHP

Viewed 101

I am using templates to separate my logic and views. I am using multiple includes to separate the different parts of the base template. I have the previous version of the templates available here(https://github.com/ookma-kyi/ookma-kyi-core/tree/master/App/Views). The issue is The index page "index.html" has this bit of code:

{% extends "base_generic.html" %}
{% block title %}Index Page{% endblock %}
{% block body %}
    <h1>Welcome</h1>
    <p>Welcome Martial Artist. Do you think you are the best of the best? Well why not find out!</p>
{% endblock %}

It is included from base_header.html:

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{% block title %}Untitled{% endblock %}</title>
<link rel="stylesheet" href="css/bootstrap.min.css">

Which is included from base_generic.html:

<!DOCTYPE html>
<html lang="en">
    <head>
        {% include "base_header.html" %}
    </head>
    <body>
        {% include "base_navbar.html" %}
        {% block body %}
        {% endblock %}
        {% include "base_footer.html" %}
        {% include "base_scripts.html" %}
    </body>
</html>

It defaults to Untitled inside base_generic.html instead of the one in Home/index.html. I have tried everything and still can't figure out the issue. Please help!

0 Answers
Related