Bootstrap - linusnorton/xFrame GitHub Wiki
It may be necessary to bootstrap your application with certain settings. This can achieved in two ways:
Controller Level Bootstrap
Using a shared controller:
use \xframe\request\Controller;
class MyController extends Controller {
/**
* Called before run() and about()
*/
public function init() {
parent::init();
$this->view->navigation = array("home", "about", "contact");
}
/**
* @Request("index")
*/
public function run() {
}
/**
* @Request("about")
*/
public function about() {
}
}
Application Level Bootstrap
Using inheritance:
use \xframe\request\Controller;
class Bootstrap extends Controller {
/**
* Called all requests
*/
public function init() {
parent::init();
$this->view->navigation = array("home", "about", "contact");
}
}
class Index extends Bootstrap {
/**
* @Request("index")
*/
public function run() {
}
}
class About extends Bootstrap {
/**
* @Request("about")
*/
public function about() {
}
}