Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Input::extension() doesn't work in HMVC request
  • Hi, I'm trying to create new request in controller to execute.

    \Request::forge($this->request->uri . '.' . Input::extension(), false)->execute();

    but, in this request, Input::extension() returns nothing.
    I think $detected_uri and $detected_ext should be copied in constructor.
    or should I use Request::main()->input()->extension() ?

  • Where exactly do you use this?

    If I do


    in action_index() of the welcome controller, and I use the URL it dumps "html" as it should?
  • thank you for reply.

    I think I should write more 
    class Controller_Welcome extends Controller {
    function action_index() {
    return Request::forge('/test/', false)->execute();
    class Controller_Test extends Controller {
    function action_index() {
    in above code, Input::extension() doesn't work in Controller_Test::action_index() 
    if it's come through welcome controller.

  • Ok, clear.

    This is logical, the URI to your Controller_Test is "/test/", it doesn't have an extension. It should have if you do

    return Request::forge('/', false)->execute();

    Input isn't global, the default instance it is relative to the active request, so it returns input from the current request, not from it's parent. Only the actual input data (GET, POST, ...) is inherited if you don't pass a method and method data to your secondary request.
  • Thank you for your reply.

    I tried your code.

    return \Request::forge('/test.html', false)->execute();

    But this didn't work for me.

    so I try to read source code.

    Input::extention() returns $detected_ext parameter in Input_Instance,
    but the parameter is not set if it's forged with request.

    $detected_ext parameter should be initiated in extension method ?

  • HarroHarro
    Accepted Answer
    Please make an issue for it at so it can be looked at.

Howdy, Stranger!

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

In this Discussion