General

  eZ Systems Website
  Technical documentation
  Editor documentation

This Documentation contains:
 
Technical documentation:



⚠ WARNING ! This documentation is deprecated !

Please go to the current Technical Documentation

Skip to end of metadata
Go to start of metadata

Custom 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 function getAllRidesAction:

HomepageController.php

Create template to display the list of Rides

Create app/Resources/AppBundle/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 will 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/AppBundle/views/content/view/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

 


 

Tutorial path