Reputation: 31749
I have this twig template:
{% block javascripts %}
{% javascripts '@AibFrontendBundle/Resources/public/js/update.js' %}
<script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js'></script>
<script src="{{ asset_url }}" type="text/javascript"></script>
{% endjavascripts %}
{% endblock %}
{% block content %}
<div id="contents">
{{ contents|raw }}
</div>
<form action="{{ path('homepage') }}" method="post">
{{ form_widget(form) }}
<input type="submit" />
</form>
{% endblock %}
It shows correctly the content.
But if I add this line below at the begining
{% extends 'AibFrontendBundle::layout.html.twig' %}
It shows layout.html.twig's content but the content I mentioned above is not showed any more..
How to show that content again?
Upvotes: 2
Views: 438
Reputation: 27102
Your layout.html.twig
template should include something similar to the following:
{% block content %}some optional default content here{% endblock %}
which will be replaced by whatever you supply in your page template:
mypage.html.twig:
{% block content %}
This will appear in layout.html.twig where I specified the above block
{% endblock %}
See the Twig documentation for further details
Upvotes: 3