On Fri, Jan 23, 2009 at 4:36 PM, Matthew Weier O'Phinney <[email protected]>wrote:
> -- David Mintz <[email protected]> wrote > (on Friday, 23 January 2009, 04:14 PM -0500): > > I have view variables that I want to be set in every view instance -- > things > > like paths to public resources. So I have been doing something stolen > from an > > example somewhere a long while ago: > > > > $view = new Zend_View; > > $view->web_root = Zend_Registry::get('siteConfig')->paths->web_root; > > if (Zend_Auth::getInstance()->hasIdentity()) { > > $view->user = Zend_Auth::getInstance()->getIdentity(); > > } > > // etc > > $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); > > $viewRenderer->setView($view); > > Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); > > Try changing the above three lines to this, and see if it makes any > difference: > > $viewRenderer = > Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer') > $viewRenderer->setView($view); > Same story. e.g., I stick this stdClass $user object in the view in my bootstrap, and can dump it in the view, but the helper doesn't see it. How do people deal with this? It's got to be a common scenario. I suppose I could pass whatever to the helper as args to the helper call. Would it make a difference if I set these view vars in a plugin? Hmm I think I'll try and see for myself... -- David Mintz http://davidmintz.org/ The subtle source is clear and bright The tributary streams flow through the darkness
