Documentation:Extending

From TinyMVC Documentation

Jump to: navigation, search

Learning by example

Lets extend the TinyMVC_Controller class:

myapp/plugins/my_controller.php

class My_Controller extends TinyMVC_Controller
{
  function __construct()
  {
    parent::__construct();
  }
  // do your class extensions here
}

Then in your controllers, just extend your custom controller:

class Hello_Controller extends My_Controller
{
  function index()
  {
    $this->view->display('hello_view');
  }
}


You do not need to include your extension file, TinyMVC will autoload it so long as it is named classname.php in the plugins directory.

The same procedure applies for extending TinyMVC_Model and TinyMVC_View.


Personal tools