之前的问题似乎都没有任何信息,大约一天半的随机谷歌搜索结果一无所获。
我想要做的是,我有一个 base.html.twig 模板,然后是一个包含几个 ui 元素(幻灯片、导航菜单等)的文件夹。我应该能够做到这一点的想法:
page.html.twig 包含
{% 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 包含
<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>
问题是这将呈现如下:
// Content from 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 from bottom of base.html.twig
问题是我如何使这个输出如下:
// Content from 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 from bottom of base.html.twig