Customize your homepage template
Let's modify the Resources/views/content/full/root_folder.html.twig
adding a call to a subrequest to display the list of all existing Rides with pagination:
Create your sub controller to display list of Rides
Create your /src/AppBundle/Controller/HomepageController.php
with the method getAllRidesAction
:
Create template to display the list of Rides
Create app/Resources/views/list/rides.html.twig
template. You use a <table> to display the list of rides. The <thead> of the <table> is in this Ride list template and each <tr> (line of the table) is in the line ride template.
So each time you use the line Ride template, you have to remember the choice of using a <tr>.
The next step is to create the override rule to use a dedicated template for the view line of Rides.
To do so, you need to configure your Bundle to inject override configuration.
Use a custom template to display view line of a Ride
You add the rule for the line_ride template to be used in your app/config/ezplatform.yml
file.
Create your app/Resources/views/line/ride.html.twig
template.
Remember, it's only one line of a table, so you will find a <tr> tag with some <td> tags.
Go to the homepage of your Tutorial website, and you will see the list of Rides !