Created new page do display single ship and linked this from homepage with names routes.

This commit is contained in:
Krzysztof Płaczek
2024-10-18 12:20:50 +02:00
parent 2eccc51981
commit fd96b128d0
3 changed files with 48 additions and 0 deletions

View File

@@ -2,4 +2,8 @@
{% block body %}
{{ variable }}
<a href="{{ path('app_starship_show', {'id' : 1}) }}">Ship 01</a>
<a href="{{ path('app_starship_show', {'id' : 2}) }}">Ship 02</a>
<a href="{{ path('app_starship_show', {'id' : 3}) }}">Ship 03 (not found)</a>
{% endblock %}

View File

@@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}{{ ship.name }}{% endblock %}
{% block body %}
<h1>{{ ship.name }}</h1>
<table>
<tbody>
<tr>
<th>Class</th>
<td>{{ ship.class }}</td>
</tr>
<tr>
<th>Captain</th>
<td>{{ ship.captain }}</td>
</tr>
</tbody>
</table>
{% endblock %}