General

  eZ Systems Website
  Editor documentation


  Developer documentation

  Back to the top

Skip to end of metadata
Go to start of metadata

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:

root_folder.html.twig

 For the moment, we use a simple render() Twig function but when we talk about cache, we will use render_esi.

Create your sub controller to display list of Rides

Create your /src/AppBundle/Controller/HomepageController.php with the method getAllRidesAction:

HomepageController.php

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>.

rides.html.twig

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.

ezplatform.yml

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.

ride.html.twig

Go to the homepage of your Tutorial website, and you will see the list of Rides !

 

 

 

 

Tutorial path