2010年8月11日星期三

[fw-mvc] Re: View Helper classes - help! 'Plugin by name... not found in the registry'

Rishi Daryanani wrote:
>
> /* Set helper path for our custom helpers */
> $view = new Zend_View;
> $view->addHelperPath('../application/views/helpers/', 'My_View_Helper');
> Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setView($view);
>
If you are using Zend_Application, you can do this instead:

; application.ini
resources.view.helperPath.My_View_Helper = APPLICATION_PATH
"/views/helpers"


Obviously this assumes that your constant "APPLICATION_PATH" is pointing to
what is equivalent to your "../application/" shown in your above call to
$view->addHelperPath(...).

Also, if you are using Zend_Application and you've already configured the
view resource (eg: you have something in your application.ini that starts
with "resources.view.") then you don't need to do:
$view = new Zend_View since there is already a view instance available to
the bootstrap...you just have to get it.


// bootstrap view resource
$this->bootstrap('View');
/* @var Zend_View */
$view = $this->getResource('View');

-----
--
Wil Moore III

Why is Bottom-posting better than Top-posting:
http://www.caliburn.nl/topposting.html
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/View-Helper-classes-help-Plugin-by-name-not-found-in-the-registry-tp2318421p2321391.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: