Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
module in module folder got loaded without config.php
  • Anyone have same experience? 

    I have created a very simple module say /Admin, and got /admin/classes/controller/admin.php and  /admin/classes/model/admin.php. with a namespace "Admin" 

    and when I uncomment "APPPATH.'modules'.DS," in config.php, and without putting the name space "Admin" into "module(array) " in "always_load" in config.php, the module Admin already working. 

    WHEN I commented out "always_load => modules" in both App/config.php + core/config.php, the module still working. 

    and url to http://localhost/admin/(index) reveal its working. the var_dump shows the module was loaded. 

    what have I missed ? 
  • HarroHarro
    Accepted Answer
    You don't need to "always_load" a module for it to work.

    If the routing engine determines that you are requesting a module resource, it will load the module automatically.

    You only need to "always_load" it when you need to call cross-module on every request, to avoid having to load it manually in your code.
  • Thanks for the answer, 

    I was hoping to have more options on controlling how and which module I want to load  in runtime rather than auto load everything by itself. 

    any suggestion ? 

    assume I want to load different module depends on different env


  • What I meant was that if you use a URI like

    /module/controller/method/params

    the routing engine will detect you're calling a module controller, and will auto-load the module for you.

    In all other cases where you need to access something in a module from the outside, you need to load it yourself. If you use it occasionally, manually, or if you need it all the time, via always_load.

Howdy, Stranger!

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

In this Discussion