I'm trying to figure out a few things here, and I've come to a road block.

Here's what I'm trying to do: using a controller plugin, I check the
idendity of a user and then if it exists, inject the data into the
view class for access within the templates, but it's failing for me.

I found an old discussion, dating back in June/July, talking about how
to access to the controller created view object, which I've
successfully implemented. However, adding any variables to that view
class fails.

This is my controller plugin piece:
-------------------
    public function dispatchLoopShutdown() {
       if ( Zend_Auth::getInstance()->hasIdentity() ) {
         $viewRenderer =
Zend_Controller_Action_HelperBroker::getExistingHelper('viewRenderer');
         $view = $viewRenderer->view;

         $identity = Zend_Auth::getInstance()->getIdentity();
         $view->user = $identity;
         $view->testVar = "This is a test";
       }
    }
------------------------

In my file, I have:
---------------------------------------
File: index/index.phtml

<? print_r($this->user) ?>
<? print_r($this->testVar) ?>
------------------------------------------

I hit the file correctly, but I get no values within the template.

I checked the Zend_View documents, but it feels horribly outdated or
really incomplete as it makes absolutely no mention on how to access
the view object created by the Controller class and use it in multiple
location (ie: controller plug, different controllers via "forward"
option, etc). I was thinking Zend_View was built as a singleton, but
getInstance() fails.

What am I missing here? Is it documented somewhere I can lookup?

Thanks
-- 
Philip
[EMAIL PROTECTED]
http://www.gpcentre.net/

Reply via email to