The problem has to do with Zend_Loader_PluginLoader trying to use a class
prefix which matches the sub-controller directory I am using.
My directory structure looks like this.
app/www/controllers/Account.php
app/www/controllers/Account/Ad.php
app/www/views/scripts
app/www/views/helpers
When the view file app/www/views/scripts/account/ad.php calls the helper
$this->getNav(), the plugin loader throws this exception.
File BodyNav.php was loaded but class named Account_View_Helper_BodyNav was
not found within it.
The class name should be Zend_View_Helper_BodyNav. It is using the prefix
from my sub-controller directory. Not sure why, this broke when I upgraded
to the latest trunk version.
Here is part of my bootstrap.
// initialize view
$view = new Zend_View($config->view->toArray());
$view->strictVars(); // enables tracking/detection of typos and
misspelled variables in views
$view->addBasePath($appDir . DIRECTORY_SEPARATOR . 'views'); //
shared views directory for all modules
$view->doctype(Zend_View_Helper_Doctype::XHTML1_TRANSITIONAL);
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->setViewSuffix('php')->setView($view);
$frontController = Zend_Controller_Front::getInstance(); // manages
the overall workflow
$frontController->setDefaultModule($moduleName);
$frontController->returnResponse(true); // return the response (do
not echo it to the browser)
$frontController->setControllerDirectory(array(
'www' => $appDir . DIRECTORY_SEPARATOR . 'www' .
DIRECTORY_SEPARATOR . 'controllers',
'cli' => $appDir . DIRECTORY_SEPARATOR . 'cli' .
DIRECTORY_SEPARATOR . 'controllers',
'admin' => $appDir . DIRECTORY_SEPARATOR . 'admin' .
DIRECTORY_SEPARATOR . 'controllers',
'rest' => $appDir . DIRECTORY_SEPARATOR . 'rest' .
DIRECTORY_SEPARATOR . 'controllers'
));
$frontController->dispatch();
On Mon, Jul 28, 2008 at 6:56 AM, Matthew Weier O'Phinney
<[EMAIL PROTECTED]>wrote:
> -- Michael Depetrillo <[EMAIL PROTECTED]> wrote
> (on Monday, 28 July 2008, 12:10 AM -0700):
> > Here is the problem.
> >
> > http://www.domain.com/account_ad
> >
> > Calls the method index in class Account_AdController location within
> > controllers/Account/AdController.php
> >
> > Any helpers used in the view file for this method try to render
> > Account_View_Helper_BodyNav instead of Zend_View_Helper_BodyNav or
> whichever
> > prefix I set using $view->setBasePath($path, $prefix).
>
> I need details on your bootstrap -- how are you adding controller
> directories, how are you setting up your view, what is your directory
> layout. I cannot speculate on the issue or attempt to reproduce it until
> I know these details.
>
>
> > On Wed, Jul 23, 2008 at 8:48 PM, Matthew Weier O'Phinney <
> [EMAIL PROTECTED]>
> > wrote:
> >
> > -- Endijs Lisovskis <[EMAIL PROTECTED]> wrote
> > (on Wednesday, 23 July 2008, 03:25 PM -0700):
> > >
> > > If I just switch Zend Framework 1.5 library files to Zend Framework
> 1.6
> > RC1
> > > library files I receive error:
> > >
> > > Fatal error: Uncaught exception
> 'Zend_Loader_PluginLoader_Exception' with
> > > message 'File LoggedInUser.php was loaded but class named
> > > Rn_View_Helper_LoggedInUser was not found within it.' in
> > > [full_path_removed]/library/Zend/Loader/PluginLoader.php:351 Stack
> trace:
> > #0
> > > [full_path_removed]/library/Zend/View/Abstract.php(1114):
> > > Zend_Loader_PluginLoader->load('LoggedInUser') #1
> > > [full_path_removed]/library/Zend/View/Abstract.php(545):
> > > Zend_View_Abstract->_getPlugin('helper', 'loggedInUser') #2
> > > [full_path_removed]/library/Zend/View/Abstract.php(312):
> > > Zend_View_Abstract->getHelper('loggedInUser') #3 [internal
> function]:
> > > Zend_View_Abstract->__call('loggedInUser', Array) #4
> > > [full_path_removed]/application/views/layouts/index.phtml(33):
> > > Zend_View->loggedInUser() #5 [full_path_removed]/library/Zend/V in
> > > [full_path_removed]/library/Zend/Loader/PluginLoader.php on line
> 351
> > >
> > > If I use ZF 1.5 everything is OK.
> > >
> > > Any ideas?
> >
> > First off, in 1.6, we refactored the code in Zend_View to utilize the
> > PluginLoader -- no reason to have code duplication. :)
> >
> > Most likely, what's happening is that you've got an invalid helper
> > prefix registered; why it was not throwing an error before is the new
> > question.
> >
> > Several qustions:
> >
> > * How are you setting up your views?
> > * How are you adding the Rn_View_Helper prefix to the view object?
> > * Is 'Rn' a module? or a private library namespace?
> > * Can you confirm that the file LoggedInuser.php exists on the
> helper
> > path? If so, what class is in it?
> >
> > Answer those questions, and I may have a better idea of how to fix
> the
> > issue.
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect | [EMAIL PROTECTED]
> > Zend Framework | http://framework.zend.com/
> >
> >
>
> --
> Matthew Weier O'Phinney
> Software Architect | [EMAIL PROTECTED]
> Zend Framework | http://framework.zend.com/
>