Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Subfoldersin Modules
  • Hi All;

    I have an operating Admin panel and i want to move into a module,
    First of all, i have to say thay I already read this post :

    But it doesn't help me.

    I have and Admin with  basic "core" funtionality thay i want to have in all my projects, and also i want to have a Admin panel with especific project funtionality. 
    I think in something like this:

    modules folder (modules)
        -> admin folder (modules/admin)
                 -> core folder (modules/admin/core)
                 -> blog folder (modules/admin/blog) (is only an example)

    I have set in my config.php always load 'modules' => array('admin/core','admin/blog') 

    But if i try to access to: http://localhost/site/public/admin/core i get a 404 error, i get also wit ..site/public/admin/core/admin (i have a Controller_Admin in that folder)

    I have set the namespace to Core, but i try also with Admin\Core, but it doesn't work.

    What am I doing wrong? 

    Maybe there is another way to get what i want (decentraliced admin core basically), but I don't know that ways.

    Thanks for your attention.
               

  • HarroHarro
    Accepted Answer
    You're not doing anything wrong, That is simply not supported.

    What you can do is change the layout slightly:

    modules folder (modules)
        -> admin folder
        -> adminmodules folder
                 -> admincore folder
                 -> adminblog folder (is only an example)

    En then add two module paths, 'modules' and 'adminmodules', and some generic routes:

    'admin/core(:any)' => 'admincore$1',
    'admin/blog(:any)' => 'adminblog$1'
    'admincore(:any)' => 'welcome/404',
    'adminblog(:any)' => 'welcome/404'

    The first two routes make sure /admin/core/... gets to the admincore module, and the same for the second route. The remaining to are optional, but make sure /adminblog/... won't work (you have to route to your 404 controller there).
  • OK Harro, i understand. 

    Where I have to put that routes? In app/config/routes.php ? Or in Modules especific routes in /modules/XXX/config/routes.php?


  • In the global routes, in app.

    Module routes are only read when the request URL points directly to the module, and you need routing before that.

Howdy, Stranger!

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

In this Discussion