load data from database in @layout.latte from every presenter?
Notice: This thread is very old.
- Blujacker
- Member | 89
Hello,
I believe you have to create a new class BasePresenter from which all other presenters will inherit. In this BasePresenter you can pull any necessary data from model in method beforeRender and they will be available in all child presenters.
abstract class BasePresenter extends \Nette\Application\UI\Presenter{
protected function beforeRender(){
$this->template->info1 = xyz;
$this->ŧemplate->info2 = xzy;
}
final class HomepagePresenter extends BasePresenter{
/**
* In case you need to call beforeRender method in inheriting presenter,
* do not forget to call parent::beforeRender()
*/
protected function beforeRender(){
parent::beforeRender();
}
}