I finally solved it..
// Module.php
public function init(Manager $moduleManager) {
$sharedEvents = $moduleManager->events()->getSharedManager();
$sharedEvents->attach('bootstrap', 'bootstrap', array($this,
'initializeView'), 100);
$sharedEvents->attach('Application', 'dispatch', function($e) {
$controller = $e->getTarget();
$route = $controller->getEvent()->getRouteMatch();
$controller->getEvent()->getViewModel()->setVariables(array(
'controller' => $route->getParam('controller'),
'action' => $route->getParam('action'),
));
},100);
}
// layout.phtml
<?php echo "{$controller}/{$action}; "; ?>
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/ZF2-Access-controller-name-action-from-layout-tp4624104p4644518.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]