symfony - Include then block on a Twig template -
none of previous questions seem have information , day , half of random google searches turns nothing.
what trying this, have base.html.twig template , folder several ui elements (slideshows, navigation menus, etc). idea being should able this:
page.html.twig contains
{% extends 'onmylemoncommonbundle::base.html.twig' %} {% block content %} {% include 'onmylemoncommonbundle::features.html.twig' %} {% block features %} <h2>featured articles</h2> <li><a href="#">article 1</a></li> <li><a href="#">article 2</a></li> {% endblock %} {% endblock %}
features.html.twig contains
<div class="row"> <div class="large-12 columns"> <div class="row"> <div class="large-4 small-6 columns"> {% block features %}{% endblock %} </div> <div class="large-4 small-6 columns"> {% block blogs %}{% endblock %} </div> <div class="large-4 small-12 columns"> {% block pictures %}{% endblock %} </div> </div> </div> </div>
the problem render follows:
// content top of base.html.twig <div class="row"> <div class="large-12 columns"> <div class="row"> <div class="large-4 small-6 columns"> </div> <div class="large-4 small-6 columns"> </div> <div class="large-4 small-12 columns"> </div> </div> </div> </div> <h2>featured articles</h2> <li><a href="#">article 1</a></li> <li><a href="#">article 2</a></li> // content bottom of base.html.twig
the question how make output following:
// content top of base.html.twig <div class="row"> <div class="large-12 columns"> <div class="row"> <div class="large-4 small-6 columns"> <h2>featured articles</h2> <li><a href="#">article 1</a></li> <li><a href="#">article 2</a></li> </div> <div class="large-4 small-6 columns"> </div> <div class="large-4 small-12 columns"> </div> </div> </div> </div> // content bottom of base.html.twig
i don't think possible, can try use following
{% render'bundle:controller:method' %}
where render this
<div class="row"> <div class="large-12 columns"> <div class="row"> <div class="large-4 small-6 columns"> {{ features }} </div> <div class="large-4 small-6 columns"> </div> <div class="large-4 small-12 columns"> </div> </div> </div> </div>
i hope solution problem
Comments
Post a Comment