Accesing controller vars from a block
Permalink 1 user found helpful
Hi,
I have the following situation, in my page controller I set some vars using:
Now, in the page itself, I have a block which needs to check the value of 'myvar'.
The way I did it, was in the blck template include the following code:
Is this the right way of doing it, or is there any other smart way? I just want to be sure I'm following the correct coding guidelines...
I have the following situation, in my page controller I set some vars using:
$this->set('myvar', $myvalue);
Now, in the page itself, I have a block which needs to check the value of 'myvar'.
The way I did it, was in the blck template include the following code:
$view = View::getInstance(); $myvar = $view->controller->get('myvar'); if ($myvar == 'somevalue')... etc...
Is this the right way of doing it, or is there any other smart way? I just want to be sure I'm following the correct coding guidelines...