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