php - xTrying to include a header block in Sympfony 3
I am totally new to this. I took as an example the body block.
This is my base.html.twig file content:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
{% block header %} {% endblock %}
{% block body %}{% endblock %}
{% block footer %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>
and this is my header from app\Resources\views\header\header.html.twig content:
{% extends 'base.html.twig' %}
{% block header %}
Header HeaderHeaderHeaderHeader
{% endblock %}
But this is not working for some reason. Do i need to do smth more ? thx
[UPDATE]
I attached an image to see what i want to achieve:
[UPDATE]
The content of the index.html.twig file is:
{% extends 'base.html.twig' %}
{% block body %}
<div id="wrapper">
<div id="container">
afdsfsdfsfasddf
</div>
</div>
{% endblock %}
{% block stylesheets %}
<style>
body { background: #F5F5F5; font: 18px/1.5 sans-serif; }
</style>
{% endblock %}
Answer
Solution:
you should inspire you in this example :
http://symfony.com/doc/current/templating.html#template-inheritance-and-layouts
Answer
Solution:
I suggest you to do that:
base.html.twig
header.html.twig
Remove this section
And make only the header content
index.html.twig