Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Default module route
  • Hi guys, I'm currently playing with FuelPHP and I have a little question regarding the module routing system. For the app itself, we can add a default route in the config.php file. But is it possible to define a default route for the modules as well? For example, I would like to have an 'index' controller as default controller so I just have to go to [url=http://localhost/app/my_module/]http://localhost/app/my_module/[/url] and it will load the index controller. I already tried to insert a config file (app/modules/my_module/config/config.php) with the routes for a given module, but it didn't work. Do you know a way to do that? Regards,
  • Default controllers for directories and modules are done by convention: they should have the same name as the directory/module. A directory "users" in app/classes/controller would be:
    class Controller_Users_Users extends Controller {}
    A module "users" in app/modules/users/controller would be:
    Namespace Users;
    class Controller_Users extends Controller {}
    And a directory "groups" in Users would work again like normal:
    Namespace Users;
    class Controller_Groups_Groups extends Controller {}
  • So simple... Thanks for the solution. :)

Howdy, Stranger!

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

In this Discussion