HTML and CSS Reference
In-Depth Information
Chapter 9
Building the Back-End: Part 2
In the last chapter, you built a working MVC framework and put together the Home controller and view. In this
chapter, you'll complete the back end of the app by building the Question and Room components. This chapter puts
the Model class to work, as well as the form submission handling that you built in the previous chapter.
Building the Questions
It might seem backward to build the Question controller before the Room controller, but because the Room controller
needs several snippets of markup from the Question controller to output its view, let's start here and work to the
Room controller.
Building the Question Controller
To begin, create a new file called class.question.inc.php in system/controllers/ and add the following code:
<?php
/**
* Processes output for the Question view
*
* @author Jason Lengstorf <jason@lengstorf.com>
* @author Phil Leggetter <phil@leggetter.co.uk>
*/
class Question extends Controller
{
public $room_id,
$is_presenter = FALSE;
/**
* Initializes the class
*
* @param $options array Options for the controller
* @return void
*/
 
Search WWH ::




Custom Search