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]>

>
> 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.
>

Reply via email to