关于如何用树枝附加块有几个问题.答案总是使用继承和使用,然后调用parent().不知怎的,我不知道这在我的具体情况下是如何工作的:
base.html.twig
{% block content %}{% endblock %}
{% block appendable %}
{% endblock %}
{% block another_appendable %}
{% endblock %}
Run Code Online (Sandbox Code Playgroud)
site.html.twig
{% extends base.html.twig %}
{% block content %}
{# Here use/include/embed, i dont know #}
{% use sub1.html.twig %}
{% use sub2.html.twig %}
{% endblock content %}
Run Code Online (Sandbox Code Playgroud)
sub1.html.twig
Some content that should be directly rendered
{% block appendable %}
some stuff that should be added to appendable
{% endblock %}
{% block another_appendable %}
This content should …Run Code Online (Sandbox Code Playgroud)