Re: [symfony-users] Re: Highlighting menu based on controller called

2012-06-18 Thread Pierre de LESPINAY
Couldn't we organize the menu by controller or bundle ? So we could base the selected item on it -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users"

Re: [symfony-users] Re: Highlighting menu based on controller called

2011-05-29 Thread oscar balladares
Oh! I forgot. For your actual request, yes, you can do the same for the controller, just toggle "_route" with "_controller" instead. app.request.attributes.get('_controller') I actually post a question about this, it was because '_controller' was not available when you call the 'render' helper to

Re: [symfony-users] Re: Highlighting menu based on controller called

2011-05-29 Thread oscar balladares
What I'm doing is to get the actual route in template, and if a route matchs a category (lets say), then print an "id='current'" for example: Home That's it. Of course it will become clumsy when you have many links cause it is hard to read through. I'll go with MenuBundle in my next project upda

[symfony-users] Re: Highlighting menu based on controller called

2011-05-29 Thread FuzzyBird
I think a good way to do it is, in the controller : // first generate the menu structure // you may want to do the following in a loop for all your menu items if ($this->get('router')->generate('some-route') === $this- >get('request')->getRequestUri() ){ // highlight the link of this route

[symfony-users] Re: Highlighting menu based on controller called

2011-05-13 Thread Carl
That's perfect! Thanks. :D -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroup

[symfony-users] Re: Highlighting menu based on controller called

2011-05-13 Thread waters
I am using MenuBundle to do exactly this. If you follow the documentation and create a MainMenu class and include it in a template, then within a controller you can access the menu and tell it which menu item should be current. This way the current item is set before the menu is rendered. For ex