Marco Pivetta wrote
> 
> I simply mean that you should check as following (pseudocode):
> 
> $viewModel = $controller->getEvent()->getViewModel();
> if (!$viewModel->getVariable('controller')) {
>     $viewModel->setVariable('controller', $route->getParam('controller'));
> }
> 
> Marco Pivetta
> 
> http://twitter.com/Ocramius
> 
> http://marco-pivetta.com
> 
> 
> 
> On 18 May 2012 17:50, cmple <roman.vidyayev@> wrote:
> 
>>
>> Marco Pivetta wrote
>> >
>> > Careful, I would not just blindly overwrite them. Leave the ones that
>> are
>> > currently set, or make that logic configurable :)
>> >
>> > Marco Pivetta
>> >
>> > http://twitter.com/Ocramius
>> >
>> > http://marco-pivetta.com
>> >
>> >
>> >
>> > On 18 May 2012 15:37, cmple [via Zend Framework Community] <
>> > [email protected]> wrote:
>> >
>> >> 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}; "; ?>
>> >>
>> >> ------------------------------
>> >>  If you reply to this email, your message will be added to the
>> discussion
>> >> below:
>> >>
>> >>
>> http://zend-framework-community.634137.n4.nabble.com/ZF2-Access-controller-name-action-from-layout-tp4624104p4644518.html
>> >>  To unsubscribe from Zend Framework Community, click
>> >> here&lt;
>> http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&amp;node=634137&amp;code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4&gt
>> ;
>> >> .
>> >> NAML&lt;
>> http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml&gt
>> ;
>> >>
>> >
>> Not sure what you mean, can you give me a code example?
>>
>> --
>> View this message in context:
>> http://zend-framework-community.634137.n4.nabble.com/ZF2-Access-controller-name-action-from-layout-tp4624104p4644681.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>> --
>> List: [email protected]
>> Info: http://framework.zend.com/archives
>> Unsubscribe: [email protected]
>>
>>
>>
> 
Oh, got it! thanks!!

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-Access-controller-name-action-from-layout-tp4624104p4644700.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to