Reputation: 1687
I've some trouble with Twig. I don't understand why one of my block is rendering two time in my page.
A-propos.html.twig
{% extends "::layout-v2.html.twig" %}
{% set contexte = "a-propos" %}
{% block content %}
//some stuff
{% block rightbar %}
{{"Je suis dans le block de la vue rightbar"}}
{{ parent() }}
{% endblock %}
//some stuff
{% endblock %}
layout-v2.html.twig
{% include '::header/header-v2.html.twig' %}
<body class="">
{% block topBar %}
{% endblock %}
{% if app.user %}
{% include '::layout-user-v2.html.twig' with {'view_content': block('content')} %}
{% else %}
{% include '::layout-public-v2.html.twig' with {'view_content': block('content')} %}
{% endif %}
{% block rightbar %}
<div class="col-sm-3">
{% if contexte is defined %}
{% include 'BtpGeneralBundle:Sidebars:sidebar_contexte.html.twig' %}
{% else %}
{% include 'BtpGeneralBundle:Sidebars:sidebar_default.html.twig' %}
{% endif %}
</div>
{% endblock %}
{% include '::footer/footer-js-v2.html.twig' %}
</body>
I don't understand why the view sidebar-context.html.twig is rendering first time on the right place and another time just before the include footer-js...
Thank
Upvotes: 0
Views: 489
Reputation: 904
You could split {% block content %} in A-propos.html.twig on two parts, e.g. contetn1 before rightbar and contetn2 after.
Upvotes: 1