I'm organizing my website in sections, which should be visible at first glance on my navigation bar (with an active class on the appropriate link). At the moment, I'm checking for each link in the navbar if the current URL matches the one for the link, but it's only working for 1 URL in each case. It should be like this :
article---------------->articlesectionarticle/create----->articlesectionarticle/edit-------->articlesectionforum------------------->forumsectionforum/post/12345->forumsection
Since all my "sections" use controllers, I was thinking maybe I could implement a way (maybe using the constructor) to pass a variable (section) to all the views returned by a controller, so that my layout can have access to it and set the active class on the proper link.
But I don't want to have to do return View::make('myView')->with('section', $this->section); everytime
Anyone knows how to achieve that ? Thanks.