Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Uri class
  • I miss a feature to access router segments. Uri::rsegment();
    Uri::rsegments(); Or is there an other way to have access to these segments?
  • We don't really have routed segments, the important parts are saved with the Request object:
    Request::active()->module // current module
    Request::active()->directory // current controller directory
    Request::active()->controller // current controller
    Request::active()->action // current controller method
    Request::active()->method_params // current controller method params
    
  • Why is it called Request::active() if everything is about the current URI? Wouldn't it sound better if it was:
    Request::current()->module // current module
    Request::current()->directory // current controller directory
    Request::current()->controller // current controller
    Request::current()->action // current controller method
    Request::current()->method_params // current controller method params
    
  • You'd be right if it were only about the Uri in a MVC framework, Fuel is HMVC however by design. Which means that any request has these settings and the active request is the one you're currently in. In a HMVC request these values will be different than within the main request that was actually called from the Uri. Edit: and I forgot to explain: this is not about the Uri. CI may call this routed Uri, not so in Fuel. This is a Request object that executes your controller and the action (method) in that controller. A request object's properties can be used to describe the routed Uri, but that doesn't mean it's the same.

Howdy, Stranger!

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

In this Discussion