我为我的实体使用了 CRUD 生成器,然后我集成了一个模板 AdminLTE;有用; 现在我尝试设置我的树枝文件的显示我从new.html.twig
文件(表单)开始我希望它遵循基本模板的布局
new.html.twig
{% extends 'base.html.twig' %}
{% block body %}
<h1>User creation</h1>
{{ form_start(form) }}
{{ form_widget(form) }}
<input type="submit" value="Create" />
{{ form_end(form) }}
<ul>
<li>
<a href="{{ path('user_index') }}">Back to the list</a>
</li>
</ul>
{% endblock %}
index.html.twig
{% extends 'base.html.twig' %}
{% block body %}
<h1>User list</h1>
<table>
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Lastname</th>
<th>Gender</th>
<th>Birthday</th>
<th>Birthplace</th>
<th>Email</th>
<th>Phonenumber</th>
<th>Grade</th>
<th>Profile</th>
<th>Documentid</th>
<th>Photoid</th>
<th>Directeur</th>
<th>Codirecteur</th>
<th>Effectue</th>
<th>Mediaid</th>
<th>Created</th>
<th>Updated</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td><a href="{{ path('user_show', { 'id': user.id }) }}">{{ user.id }}</a></td>
<td>{{ user.name }}</td>
<td>{{ user.lastName }}</td>
<td>{{ user.gender }}</td>
<td>{% if user.birthday %}{{ user.birthday|date('Y-m-d') }}{% endif %}</td>
<td>{{ user.birthPlace }}</td>
<td>{{ user.email }}</td>
<td>{{ user.phoneNumber }}</td>
<td>{{ user.grade }}</td>
<td>{{ user.profile }}</td>
<td>{{ user.documentId }}</td>
<td>{{ user.photoId }}</td>
<td>{% if user.directeur %}Yes{% else %}No{% endif %}</td>
<td>{% if user.coDirecteur %}Yes{% else %}No{% endif %}</td>
<td>{% if user.effectue %}Yes{% else %}No{% endif %}</td>
<td>{{ user.mediaId }}</td>
<td>{% if user.created %}{{ user.created|date('Y-m-d H:i:s') }}{% endif %}</td>
<td>{% if user.updated %}{{ user.updated|date('Y-m-d H:i:s') }}{% endif %}</td>
<td>
<ul>
<li>
<a href="{{ path('user_show', { 'id': user.id }) }}">show</a>
</li>
<li>
<a href="{{ path('user_edit', { 'id': user.id }) }}">edit</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul>
<li>
<a href="{{ path('user_new') }}">Create a new entry</a>
</li>
</ul>
{% endblock %}
config.yml
#Twig Configuration twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
form_themes: - user:new.html.twig
在接触 config.yml 之前,我将它附加了显示: