Controllers, like the models, can be created using Oil. The main controllers will be for managing entries and categories. These will come in two flavors, the publicly viewable site controllers and the administration system for the entries and categories tables.
Our controllers probably won't be needed to handle RESTful requests, at least initially. So, we should extend the Controller_Template
and as luck would have it, that is the way that the Oil tool is set up to run. When we create a controller with Oil, it'll be created to extend the template controller. We only need to think about what actions and methods we need for doing this. As we will primarily be displaying the entries and categories information for the blog, let's start with the index
and view
actions:
$ php oil g controller entry index view
This will create the controller, a template file, and the views needed for the methods—index
and view
.
Let us have a look at entry.php
, which is located at fuel/app/classes/controller...