Documentation:Instance

From TinyMVC Documentation

Jump to: navigation, search

Getting an Instance

There may be times you need to get an instance of the current object, such as within a library, so you can use the controller functions. You can get an instance at any time:

$tmvc = tmvc::instance();
 
$myvars['foo'] = 'bar';
$myvars['baz'] = 'gaz';
 
$output = $tmvc->controller->view->fetch('some_view',$myvars);

Available Properties

The TinyMVC instance has these properties available:

$tmvc->controller // the current controller object
$tmvc->action // the current controller method being used
$tmvc->url_segments // the array of segments from the url path_info
$tmvc->config // the loaded config array
Personal tools