You assumption was right.
Either two followings directives worked:
resources.view.helperPath.View_Helper_ = APPLICATION_PATH
"/modules/default/views/helpers"
resources.view.helperPath.View_Helper_ =
"../application/modules/default/views/helpers"
Thanks
--
Guillaume
Le 18/12/09 03:16, Mon Zafra a écrit :
I think it's because the paths are relative to the public directory.
Try APPLICATION_PATH "/modules/default/views/helpers" and
APPLICATION_PATH "/views/helpers".
Also, I believe the second line would just overwrite the first.
-- Mon
On Thu, Dec 17, 2009 at 4:08 AM, Guillaume ORIOL <[email protected]
<mailto:[email protected]>> wrote:
Thank you Daniel.
I renamed the two helpers the way you told and everything went fine.
Do you know why none of those two parameters in application.ini
did work?
resources.view.helperPath.View_Helper_ =
"application/modules/default/views/helpers"
resources.view.helperPath.View_Helper_ = "views/helpers"
Le 16/12/09 16:49, Daniel Latter a écrit :
Hi,
Im no expert but Ill point out what I can see.
First, the reason why you are only getting one error because the
Profile helper has errors ( $this- view->url .. ) in it so my
guess is this one is silently dying, fix the error and you will
get 2 exceptions.
Second, if you want helpers to load automatically without setting
your own name-spaced helper paths you need to name them
appropriately, so in your case, providing they are in the folders
you state, you would use Zend_View_Helper_CustomFooter, and
Zend_View_Helper_Profile. If you do this both helpers should be
found no probs.
Hope this helps.
Dan
2009/12/16 Guillaume ORIOL <[email protected]
<mailto:[email protected]>>
Hi,
I encountered an error which relates to view helpers. The
message says
"Uncaught exception 'Zend_Loader_PluginLoader_Exception' with
message
'Plugin by name 'CustomFooter' was not found in the
registry". I don't
understand why I get the error on one of the two helpers and
not on the
other.
In my layout file, I render two scripts for header and footer.
/* application/layouts/scripts/layout.phtml */
...
<?php echo $this->render('header.phtml'); ?>
<?php echo $this->layout()->content; ?>
<?php echo $this->render('footer.phtml'); ?>
...
In header.phtml, I use a view helper for user identification:
<?php echo $this->profile(); ?>
and in footer.phtml I use another view helper for adding a
custom footer:
<?php echo $this->customFooter(); ?>
Here are those view helpers:
/* application/modules/default/views/helpers/CustomFooter.php */
class View_Helper_CustomFooter extends Zend_View_Helper_Abstract
{
public function customFooter()
{
$settings = new Model_Settings();
$rowset = $settings->find(1);
$row = $rowset->current();
$footer = $row->footer;
if ($footer) {
return '<div id="customFooterWrapper">' . $footer
. '</div>' .
PHP_EOL;
}
return '';
}
}
/* application/modules/default/views/helpers/Profile.php */
class View_Helper_Profile extends Zend_View_Helper_Abstract
{
public function profile()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$id = $auth->getIdentity();
return '<div id="identificationUser">'
. $this->view->escape($id->first_name) . ' '
. $this->view->escape($id->last_name) . ' '
. '</div>'
. ' "'
. $this- view->url(array('controller' =>
'auth', 'action'
=> 'logout'), 'default', false)
. '">logout ' . PHP_EOL;
} else {
return ' "'
. $this- view->url(array('controller' =>
'auth', 'action'
=> 'login'), 'default', false)
. '">login ' . PHP_EOL;
}
}
}
--
View this message in context:
http://n4.nabble.com/one-of-two-view-helpers-cannot-be-found-tp965101p965101.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
Guillaume ORIOL