Creating the FO controllers and displaying the data
In the first section of this chapter, we designed the module to display three types of pages in the FO. Before getting into the practical coding, let’s present how to create a FO controller to display a front page for our module.
We saw that we needed to extend the ModuleFrontController
class to create a new FO controller by following the naming conventions already presented. As ModuleFrontController
is a child class of the FrontController
class, we can override the existing method of its life cycle.
As a reminder, we have the following methods sequence:
init()
setMedia()
postProcess()
initHeader()
initContent()
initFooter()
display()
In our case, as we need to add content to the body of our page layout, we will override the initContent()
method in our classes.
Let’s start by creating the blog home FO controller displaying the three latest blog posts published. The first...