- / |- fuel |- publicAll magic happens in the fuel folder; public is just there to publish the required assets so that you won't have to deal with them in the .htaccess with a RewriteRule (like one has to do when using CI); so I won't be focusing this on the public folder. The fuel directory is structured separating the 'core' (which make all of FUEL work), a 'packages' folder (which I'll cover later on) and the 'app' folder. Just by the name one knows that we should not mess around the core folder, it's the core and so it should stay: unmodified. Here comes the pourpose of all this: the app folder contains the developed application. Good! But, what if I wan't to have multiple applications running in my Hosting Service? I mean completely unrelated applications? Well out of the box one would have to create a second fuel folder to host the second application. But what if instead of an app folder there would be an apps folder? A container for multiple apps! This isn't done very hard, just rename the app folder to apps folder and copy all it's contents to a new sub-folder with the name of the app. So we could have this:
- /fuel |- apps |- my_awesome_app |- cache |- classes ... |- my_other_ awesome_app |- cache |- classes ... |- core |- packagesSo now we host two different applications with the same core files, having a much better control about the fuel distribution. This also means that when updating FUEL we must be more careful, because we affect all apps, but hey! that's why there's webmasters right? Personally I think this structure is much more useful. So If you only have one app it doesn't matter, but you could host multiple apps right from the start. I would suggest that this structure made it to the final v1.0 of FUEL. So, now what changes must we make to let this happen? Well that's the best thing of all, we must only make a small change that we would make anyways. In the index.php file inside the public folder (the 'frontend' of our app) we make this change: From:
/** * Set all the paths here */ $app_path = '../fuel/app'; $package_path = '../fuel/packages/'; $core_path = '../fuel/core/';To:
/** * Set all the paths here */ $app_path = '../fuel/apps/my_awesome_app'; $package_path = '../fuel/packages/'; $core_path = '../fuel/core/';It's just a small change that opens up a great possibility to share the framework to multiple applications. I think this should be a essential part of the framework. What do you think? One think I have to say although I'm not sure if it will work in every case is that one does not have to make the .htaccess stated in the documentation to make this work with sub-folders in the DocumentRoot (I didn't add the RewriteBase part and so on, just using the plain default .htaccess file with sub-folders in the DocRoot using this apps approach... works like a charm!). So now, on to the packages folder! Well... using this method to share the core files we can also share the packages folder, thus using only one copy of them and using them on multiple apps (which really, that's what packages are supposed to be for, isn't it?). So let me know what do you think of this!
- fuel - first_app - second_app - third_app - core - packagesAnd then configure my front controllers to point to the same core/packages dirs but different apps. If you feel they should go into a "apps" subfolder that's up to you, and that's why we kept this configureable.
It looks like you're new here. If you want to get involved, click one of these buttons!