Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
problem on controller_hybrid
  • on version 1.3 onward, I have this problem.

    I have function "action_index" and function "get_index" both exist in a controller_hybrid. when I do a normal page load, suppose it will go to "action_index" but it always go to "get_index".

    example code:

    public function action_index()
    {
    die('action_index');
    }

    public function get_index()
    {
    die('get_index');
    }


    Anyone can help me? I can't upgrade my code to v1.4 ( currently using v1.2.1 ).
  • HarroHarro
    Accepted Answer
    No, it doesn't work that way.

    get_ / post_ always have preference above the action_ prefix.

    The controller is agnostic as to how you access it. So you can't have separate methods for ajax and non-ajax calls with the same name.
     
  • Somehow it worked on version 1.2.1.

    The documentation also written in the way i did:

    If it is not the correct way, please change the documentation as it is confusing people.
  • 1.2.1. didn't have method support, browser requests were always served by action_, hardcoded.

    The docs are indeed outdated, I'll correct them.

Howdy, Stranger!

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

In this Discussion