Chapter 2. Creating a Simple News Reader
This chapter explains how to write your first controller in order to display news items list and details, make interactions between controllers and views, and then customize the view's layout.
In this chapter, we will go through the following:
- Creating controller and action
- Creating a view to display the news list
- How the controller sends the data to view
- Example – create a controller to display the static news items list and details
- Split the common view content into reusable views
- Example – render partial in view
- Creating static pages
- Share data between views and layout
- Example – change layout background based on the URL parameter
- Layout with dynamic blocks
- Example – add dynamic box to display advertising info
- Using multiple layouts
- Example – using different layout to create responsive and not responsive layout for the same view