Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How do I get the current controller name from a view?
  • Hello,

    I have a common navigation view partial. I would like to change a css property of a nav item if that happens to be the page the user is on. So, if they're in about/index I want them to have "About" bolded in the navigation. How do I detect they're on the about section in FuelPHP? Rails has a feature like this but I haven't seen this in FuelPHP yet.

    Thanks,

    .dh
  • You can retrieve that information from the Request object, or from the Route object which is a property of the Request object. You can get the object using \Request::active();

    FuelPHP doesn't have a read-made breadcrumb module, since it('s implementation) is very application specific, you can't make anything generic.

    If you don't want the routed URI, but you want the URI as typed in by the user, you can use \Uri::segments().

    Just Debug::dump() them, see what information you can get from it, and work from there...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion