Now that we explained the essential ORM features and implemented our relations, it is finally time to build our to-do list. This section assumes you have executed the complete public/test.php
script at least once.
First, we will display the associated tasks when viewing a project's details. For instance, this web page should display all tasks of project with id = 2
after the project's name:
http://mytodolists.app/project/view/2
In order to do that, we can, as we did in Chapter 1, Building Your First FuelPHP Application, dissect the URL and deduce that, in this case, the view action of the Project controller is executed. The action displays project/view
; thus, we have to edit APPPATH/views/project/view.php
. Add the following code under the first paragraph displaying the project's name:
<?php echo render('task/list', array('project' => $project)); ?>
The render(...)
method is an alias for View::forge(....