This repository has been archived by the owner on Aug 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Bootstrap
linusnorton edited this page Dec 30, 2011
·
2 revisions
It may be necessary to bootstrap your application with certain settings. This can achieved in two ways:
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() {
}
}
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() {
}
}