I've been looking for a way to do something similar. I want to highlight a 
menu item if the user is in a particular category on the site. I use the 
Knplabs MenuBundle for menus on my site but it uses the full URL for 
checking to see if it should highlight a particular menu item. Without 
adding custom code to parse each URL and matching it against an existing 
list of sections you've defined somewhere in your application, I'm not sure 
how else you'd be able to do this at the moment. I don't think it's possible 
to directly get the controller name in a template. If it is, I'm curious how 
to do it as well.

If you use MenuBundle, you can write your own custom MenuItem classes and 
can choose how to render each piece of the menu. So you can prepare your 
menus using that and then only worry about rendering them in your templates. 
You may want to check it out if you haven't already. It's saved me a lot of 
time.

https://github.com/knplabs/MenuBundle/

-- 
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@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to