02. Engines

The engines folder houses the most frequently accessed parts of the MVC - the Controller and the Views bundles together as discrete applications. The engines folder contains folders that are named to reflect what the controllers or sub applications may be eg: if you create a folder names foo in engines create a file in it named controller.php and a folder named views your application is almost ready. It would map on your url to:

http://site.com/foo/

The engines folder comes with a default engine/controller named default. This is takes care of situations where one attempts to access a non existing controller and to handle such needs as accessing a landing page.

Creating a controller is automated by calling the method create on a controller and passing a string as argument that corresponds to name of the controller to be created eg:

<?php
namepasce __zf__;
calss CController extends ZController {
    function index(){
        self::create("foo");
    }
}

This will create a new controller named foo with its controller.php file and an empty views folder.