-- Bert Van Hauwaert <[EMAIL PROTECTED]> wrote
(on Thursday, 21 August 2008, 02:08 AM -0700):
> I've got a View, SE_View_Helper_FormText, that extends
> Zend_View_Helper_FormText.
> 
> In the bootstrap, I've got the following code:
> 
> $viewRenderer =
> Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
> $viewRenderer->initView(null, "Site_View");
> $viewRenderer->view->addHelperPath('SE/View/Helper', 'SE_View_Helper');
> 
> When I'm calling in my createAction $this->view->getHelperPaths(), I'm
> getting the following result:

<snip -- expected result>

> When calling $this->view->getHelperPath("FormText") before calling
> $this->render("item/form", null, true); in the createAction, then I get as
> response "SE/View/Helper/FormText.php".
> After the render, the response of $this->view->getHelperPath("FormText") =
> "SE/View/Helper/FormText.php". And the form is correctly processed with the
> SE_View_Helper_FormText helper.
> 
> Now, When I don't call $this->view->getHelperPath("FormText"), before
> calling $this->render, the SE_View_Helper_FormText isn't used.
> When calling $this->view->getHelperPath("FormText") after the render, I'm
> getting
> "/home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/library/Zend-1.5.3/View/Helper/FormText.php"
> as a response instead of "SE/View/Helper/FormText.php".
> 
> When I'm going to Form.php to the method getView(), I'm falling in the if
> statement ( if (null === $this->_view) ). 
> I added a few lines:
> 
> public function getView()
>     {
>         if (null === $this->_view) {
>             require_once 'Zend/Controller/Action/HelperBroker.php';
>             $viewRenderer =
> Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
>             $this->_view = $viewRenderer->view;
>             
>             //Show available helperPaths
>           echo "<pre>";
>             print_r($viewRenderer->view->getHelperPaths());
>             echo "</pre><hr>";
> 
>             //Show helperPath for FormText
>             echo "<pre>";
>             print_r($viewRenderer->view->getHelperPath("FormText"));
>             echo "</pre><hr>";
>         }
> 
>         return $this->_view;
>     }
> 
> As response, I'm getting this:
>  
> Array
> (
>     [0] => Array
>         (
>             [prefix] => Zend_View_Helper_
>             [dir] =>
> /home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/application/v1/private/system_mvc/views/helpers/
>         )
> 
>     [1] => Array
>         (
>             [prefix] => SE_View_Helper_
>             [dir] => SE/View/Helper/
>         )
> 
>     [2] => Array
>         (
>             [prefix] => Site_View_Helper_
>             [dir] => ./views/helpers/
>         )
> 
>     [3] => Array
>         (
>             [prefix] => Zend_View_Helper_
>             [dir] =>
> /home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/library/Zend-1.5.3/View/Helper/
>         )
> 
> )
> ----------------------------------------------
> /home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/library/Zend-1.5.3/View/Helper/FormText.php
> 
> You see here that the path for SE_View_Helper is known, but the wrong view
> helper is taken.

It looks like the library view helpers are being added to the end of the
stack, and, since helper paths are processed LIFO, it's finding that
path first.

My inclination is that something is altering your helper path stack, but
as to _what_ I'm not sure.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to