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:
$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...

matogertel
 
DavidMIRV replied on at Permalink Reply
DavidMIRV
Seems ok to me if it works?
matogertel replied on at Permalink Reply
matogertel
I was just looking for a second opinion...
Cheers!