I have a layout that applies several menus (primary, secondary, etc.) dynamically by calling components. In its simplest form, the component logic retrieves a menu by name from the database and the view iterates over the navigation items associated with that menu to display the menu.
Quick overview of the relationships: A NavMenu has_many NavMenuItems A Page has_many NavMenuItems A NavMenuItem belongs_to NavMenu, Page In short, a NavMenu has_and_belongs_to_many Pages through a NavMenuItem. Each request is answered by the Page controller via an sfPropelObject route. When I display the menu, I need to know which item is "active" so that I can treat it a little differently. To do so, I'm setting a slot in the Page controller whose value is the Page object that was requested ($this->getRoute()->getObject()). That seems a little wonky, but it's the only way I could find to set a variable in the controller that would be available to the layout and, in turn, sent to the component when called. This works great in simple scenarios, but a more complex scenario has come up. A couple of menus have child menus that need to be displayed. I'd like the layout to do that since most pages appear on a menu that has a submenu. Unless someone has a better idea, what I need to do is, in my component - within the logic that determines the active NavMenuItem - set a variable that writes that NavMenuItem object to some place where it can be picked up by the layout. Somewhere further down in the layout, I need to call the same menu component to display the submenu (if any) for the active NavMenuItem. I tried to provide context, but in case I've only created confusion the basic question is this: In a component where I'm determining the active NavMenuItem, how I can access that NavMenuItem further down in my layout? Thanks. -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@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.