Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Controller in subdirectory
  • I'm relatively new to fuelPHP development, one thing i wanted to make was a controller in a subdirectory, but I can't get it to work.

    I've got a working one in /fuel/app/classes/controller/section.php which i can call via http://my.url/section/view and now i wanted a new one in a subdirectory called api.
    So i created the folder api and placed a file called test.php with a class like
    class Controller_Api_Test extends Controller_Template { [...]
    But I just can't call it via URL. /api/test doesn't work, neither does /api_test.
    I haven't found more information in the docs about how to call those controllers.

    Can somebody explain to me how i've got to create and name those files?
  • HarroHarro
    Accepted Answer
    If it's in /fuel/app/classes/controller/api/test.php, and it's called Controller_Api_Test, a URI like "/api/test" should work without problems.

    Does it contain an action_index ?
  • Okay, now that solved it! The folder-name must be writter lowercase, so .../API/test.php does not work, neither does .../Api/test.php.
    /fuel/app/classes/controller/api/test.php is the way to go!

    Thanks for the information!
  • As per the coding standards: everything in the filesystem is lower case.

Howdy, Stranger!

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

In this Discussion