So I'm working on my own little MVC framework as a learning exercise. It's working great, but I want to be able to reference variables in my view files without $this.
So for example I have a controller object which instantiates a view object. From the controller I pass the variables to the view like this
$this->view->foo = "bar";
Then the view object includes the relevant code for the view (eg: myView.phtml). So to access "foo" in the view file I use this
echo $this->foo;
But what I would like to do, and I don't know if this is possible or wether I'm missing something obvious, but what I would like to do is reference the variables like this
echo $foo;
Without me posting the entire source, can anyone point me in the right direction?