可能です!
私はこの解決策を考え出したいくつかの実験をした後:ブロックに
{# index.html.twig #}
{% block title %}Hello world{% endblock%}
ラップグローバルレイアウト:小枝に
{# layout.html.twig #}
{% block layout %}
<html>
<head>
<title>{% block title %}{% endblock%}</title>
</head>
<html>
{% endblock %}
パス子テンプレート:
// index.php
...
$twig->display(array('template'=>'index.html.twig'));
...
を注入子テンプレートを使用してプロキシテンプレート:
{# proxy.twig #}
{% extends 'layout.html.twig' %}
{% block layout %}
{# Get extended block #}
{{ parent() }}
{# inject template into master layout #}
{% include template %}
{% endblock %}
出典
2012-03-20 18:54:32
max
あなたのコードは動作しませんか?それは有効です – seferov
はい、私はすべてのテンプレートを 'layout.html.twig'を各テンプレートファイルに追加せずに拡張します。 – max