Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class A extends Nette\Object {
- // callbacks
- public $beforeRender;
- public $template;
- public function __construct() {
- $this->template = (object) NULL;
- }
- public function render() {
- $this->beforeRender($this);
- print_r($this->template);
- }
- }
- $a = new A;
- $a->beforeRender[] = function($self) {
- $self->template->a = 'a';
- };
- $a->beforeRender[] = function($self) {
- $self->template->b = 'b';
- };
- $a->render();
Add Comment
Please, Sign In to add comment