0
我想做這樣的事情,以便如果模板不存在,它只呈現內容。下面的代碼不會工作,因爲你不能這樣編碼。Twig/Symfony2動態模板
{% if app.request.attributes.get('twig_parent_template') != "" %}
{% extends app.request.attributes.get('twig_parent_template') %}
{% block title "The Title Here" %}
{% endif %}
{% block content %}
Content here
{% endblock %}
我可以以某種方式做這種事嗎?