Step 4: the glue
The glue, or the controller is what we have here. IT takes the model by including it,
initializes the framework,
| index.php |
<?php
/* basically this is the controller part in the MVC setup */
include('config.php');
include('model/student.class.php');
include('model/teacher.class.php');
/* initialize the data */
include('datasetup.php');
/* display the data using the template engine */
$tpl = zen::getInstanceOf('Template');
$tpl->assignLoopVar('courses', $courses['name']); // $courses was initialized in datasetup
/* set the file we will use to display the courses (all we will do now)*/
$tpl->assignVarFile('content', 'courselist.tpl');
$tpl->parse();
$tpl->getContent();
?> |