I'm working on a framework that has a function invokeView() in the controller. As of now, this basically calls include on a $target php class which in turn displays a smarty template. I'd like the $target class to have access to a $response object which is created inside of the controller (the same place that calls the $target page).
Instead of having the $target page grab the $response object from a global area (like session storage), I'd like to pass it in to the $target class, maybe by having a function on the $target object like display($response). It seems like if I did something like that, the call stack would just keep growing and growing, which would not be good.
Does what I'm saying make any sense? If so, what makes more sense, passing the $response in or grabbing it from the Session?
Thanks!