Hi, iam not sure if iam doing it the right way. My Goal is to display in my Layout an Login or an Navigation at the header section.
My implementation looks like this (without logic):
2 Layout scripts:
- login.phtml
- navigation.phtml
An FrontController Plugin:
class Plugin_Header extends Zend_Controller_Plugin_Abstract {
/**
* PreDispatch
*
* Decides wich kind of navigation is displayed in header section
* for logged in users the menu, for guests the login box and
* link to registration form.
*
* @return void
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$layout = Zend_Layout::getMvcInstance();
$layout->topNavigation = $layout->render('login'); // or navigation
}
}
It works fine, but is this the best way ? ;)