CodeIgniter Forums
Multiple application resources - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: Best Practices (
+--- Thread: Multiple application resources (/showthread.php?tid=63286)

Multiple application resources - JoellSVK - 10-15-2015

Hello, I would like to ask about how to handle best multiple applications resources. I intend to develop system with possible to install more apps and i wonder what could be best way to handle files like images, css, js etc. Maybe could be good way to have in one application also those resources (where are controllers, models, configs...). 

See my attachment... What do you think ?

RE: Multiple application resources - Narf - 10-15-2015

Sorry, but that's like asking "How do I get more stuff?" ... It's a meaningless question; you need to be more specific.

RE: Multiple application resources - JoellSVK - 10-16-2015

(10-15-2015, 06:14 PM)Narf Wrote: Sorry, but that's like asking "How do I get more stuff?" ... It's a meaningless question; you need to be more specific.

It is all about just file/folder structure. Just best practice for organizing resources (images, js, css etc... ) with multiple application. What is meaningless about it ?  Huh

RE: Multiple application resources - mwhitney - 10-16-2015

It was difficult to understand what you were asking.

If you need to share resources between multiple applications, it's usually best to configure one directory to hold those resources, then configure each application to point to that directory. If you need application-specific resources, it's easiest to just add a directory named after the application inside the shared directory, but you could take the extra step of setting up individual directories along with the shared directory.

In most cases, I would setup my application something like this:
/public - index.php, assets directory containing all public files, including images, JS, CSS, and documents
/system - CI/system directory
/application - application directory

Of course, since index.php usually needs to be configured for each application, you may need several versions of this file, possibly in different locations, but you can still point to a shared location for the shared resources. You could even put application directories in your public directory to hold your index.php files and application-specific resources.

If I need shared non-public resources, I can add another directory for those and add it to the package paths in my applications or add a custom loader to load resources from multiple directories. Since I usually use Bonfire, I could place the shared code in my /bonfire directory, since Bonfire's loader is already setup to check the application, bonfire, and CI directories.