Open-Source PHP Framework - Designed for rapid development of performance-oriented scalable applications

Controllers

API >> mvc >> controllers
Controllers add dynamic abilities to your views and are the interface between views and models. The controller file is optional and pages will load fine with only a view file, but controllers significantly increase your available functionality.
The controller file must contain a class inside it with the same name as the filename plus "Controller" appended to it, eg. in a crayons file you would have a crayonsController class. The name of the file will always match the first tier of the URL to access it, eg.: www.MySite.com/crayons
Each methods inside the class is an action that corresponds to the second tier of the URL, so a green() method of the crayonsControllers class in the crayons file would have a URL of www.MySite.com/crayons/green
The index() method is a special method that is used when no action is set in the URL www.MySite.com/crayons). An associative array returned from the method gets extracted as local variables within the view, layout and elements.
so a method returning:
return array('favoriteColor' => 'blue');
Would have $favoriteColor set to blue in the view, layout and elements.

Implicit actions

There is a special constant that when set to true will make the action segment of the URL optional:
const optionalAction true;
If an action method exists then everything works normally. If no method exsists then it will send the request to the index() method; when this occurs the mvc::$action property is set to index and the mvc::$params array will contain URL segments beginning immediately after the contoller, so www.MySite.com/crayons/green/melted would have param 0 as green and param 1 as melted. If a green method was defined in the crayons controller than it would handle the request and mvc::$action would be green and param 0 would be melted.