Thanks for the reply Jason.

The actionstack was definitely the right way to go - i managed to develop a
solution using it, so thanks for pointing it out.

An explanation, in case someone has the same problem:

The actionstack is only loaded (lazy-loaded) when the actionstack helper is
used within a controllers pre/postDispatch method - it is not a plugin
loaded by default, which in my situation meant i might as well have left the
calls to the MenuFactory in the postDispatch method. 

To pass on the request data from the first request to the second simply
meant i needed to initialise the action stack as a front controller plugin
in my bootstrap:
$frontController->registerPlugin(new
Zend_Controller_Plugin_ActionStack(Zend_Registry::getInstance()));

Then in my layout:
<?php echo $this->action('index', 'submenu'); ?>

And finally, the SubmenuController. If it discovers an instance of the
actionstack, it gets the request from the plugin (not the SubmenuControllers
$this->getRequest(), which would be a new/fresh request):
        class SubmenuController extends Zend_Controller_Action 
        {
                public function indexAction(){
                        $frontController = 
Zend_Controller_Front::getInstance();                        
                        foreach($frontController->getPlugins() as $plugin){
                                if($plugin instanceof 
Zend_Controller_Plugin_ActionStack ){
                                        $menuFactory = new 
Menu_Factory_Site($plugin->getRequest());
                                        $this->view->subMenu = 
$menuFactory->getSubMenu();
                                }
                        }
                }
        }

...and the correct submenu is loaded and assigned to the view! 
-- 
View this message in context: 
http://www.nabble.com/Using-current-request-for-controller-name-in-action-helper-call-to-submenu-controller-tp20760333p20780442.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to