Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Hmvc module override question;
  • Hi, I have a big problem here :D When i try to create only a file in my app module for override an especific file in my global module the FuelPHP try to override all my global module, how can I resolve? Thnks! sorry bad english =[
  • Can you give an example, because I don't understand what you mean. What is "a file"? You want to override what?
  • Hi WanWizard! for example...
    'module_paths' => array(
    APPPATH.'modules'.DS, // path to application modules, <--- Here I use only the structure to replace especific files in global modules
    APPPATH.'..'.DS.'globalmods'.DS // path to our global modules <-- If isn't an especific file created on application module then use from global module.
    ), If i have a module client with a controller called Test in my app path module I use it else I get from global module this controller file...
    Same for view, views, configs, models... Do you understand? Thanks!
  • You can not override on a file by file basis. If you have multiple module folders, and two of them contain a module with the same name, only the first is used. This is how it works. You can't get it to work either, you will have a namespace conflict, as a namespace is mapped to a location.
  • but.. how can i resolve this problem? Is there a way? My app module extends global and replace custom methods. =[ thanks!
  • As I said, you can't. A module is a self-contained group of files, call it a sub-application if you will. It is not a file-system overlay that you can use to replace specific files elsewhere. You could do this (but then only for classes, still not for views and config files) by designing an alias system like FuelPHP is using for the core. But that is quite complicated. Alternatively you can use a routing based solution, where you generate your routes based on which modules are installed/available. This works for controllers only, not for other files. I would suggest to rethink your architecture, because this isn't going to work.

Howdy, Stranger!

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

In this Discussion