Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Several modules in module
  • Hello !
    First, sorry for my poor English (I'm French)...

    I want to create modules in module but I don't know if it's possible since I don't find any documentation or questions about this on internet and in the documentation. To make it clear I want to have a structure like this :

    fuel >
        app >
            ...
            modules >
                parentmodule >
                    submodule1
                    submodule2
                    submodule2
                    ...

    And type an URL like this one : www.site.fr/parentmodule/submodule1

    Thanks to people who will think about this ;) !
  • HarroHarro
    Accepted Answer
    It is important to have terminology right.

    A module is a self-contained group of classes, views, config, language files, etc., so its functionality can be re-used in different applications.

    There is no direct relation to the segments in the URL, other than that the first segment must be the module name (to speedup controller lookup.

    If you really want seperate modules (in the definition above), you can only do that through routing, by routing 'parentmodule/submodule1/:any' to 'submodule1/$1, and route "submodule1/:any" to your 404 handler.

    If you just want different levels of controllers within the same module, just create the controller:

    modules/parentmodule/classes/controller/submodule1/myclass.php, and define it as

    Namespace Parentmodule;
    class Controller_Submodule1_Myclass extends \Controller
    {
        ....
    }

  • Hi Harro !
    Thanks for your explanations, I understand and I'm going to do like this ;) !
    thanks for help ;) !

Howdy, Stranger!

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

In this Discussion