Multiple Applications, One Installation |
[eluser]Think Floyd[/eluser]
Hi All This has probably been done to death, but I'd like some advice anyway. So according to the User Guide, my application structure could look like this if I was to create 2 applications; "foo" and "bar". system/application/foo/ system/application/foo/config/ system/application/foo/controllers/ system/application/foo/errors/ system/application/foo/libraries/ system/application/foo/models/ system/application/foo/views/ system/application/bar/ system/application/bar/config/ system/application/bar/controllers/ system/application/bar/errors/ system/application/bar/libraries/ system/application/bar/models/ system/application/bar/views/ However, these applications will need to share some libraries, and potentially error messages and views. Where would I place common files such as a universal view or error? Thanks in advance.
[eluser]Michael Wales[/eluser]
For shared libraries, you could always place them in the system/libraries/ folder - unfortunately this is frowned upon. The CodeIgniter community takes a bit of a different stance, for the most part, than other web frameworks. other frameworks, I'm thinking Django in particular, view a website as a compilation of various applications. You create all of these applications which work together to create your "web application/website." For the most part, our applications are completely stand-alone and not reliant on one another. 9 times out of 10, the answer to shares views/errors is to just place those files within both application's directories. Version control is very useful for maintaining the accuracy between the applications and I manage all of my libraries. The library is placed in version control, then the specific application's version control system is instructed to keep the libraries/ up-to-date with what is stored within their own version control system. So if I correct a bug or add a new feature in one of my apps, it is passed on to the other apps on their next update.
[eluser]Think Floyd[/eluser]
Thanks for the prompt reply Michael. Understood about the application separation, but on the project I'm currently working on I essentially have 4 applications that are identical, bar some front-end differences. The other idea I had was to separate the applications within the Controller/View folders themselves, including the shared files, such as: Application/ Controllers/MyApp1/Some_Controller Controllers/MyApp2/Some_Other_Controller Controllers/Common/Some_Common_Controller Views/MyApp1/Some_View Views/MyApp2/Some_Other_View Views/Common/Some_Common_View I plan on reading the domains (4 in total) and setting the default_controller to run the relevant controller based on this. Would this be deemed bad form? At the moment it seems more sensible than literally duplicating the code X 4 (although I do understand the benefits on Version Control, I'm weighing up options). Thanks once again.
[eluser]wiredesignz[/eluser]
My new Modular Separation libraries might provide the features you require if you install each of your applications as a module. Modular Separation PHP5 allows modules to be installed outside of the application directory. Just alter the MODPATH and MODOFFSET constants. View the thread: Modular Separation - PHP5
[eluser]Gordaen[/eluser]
Symlinks may be a good answer. With source control, you can also specify external resources, which is another (slightly more complex) option.
[eluser]dsloan[/eluser]
Just having a quick catch-up on forum postings - is the following any use to you? http://www.philsturgeon.co.uk/news/2009/...odeIgniter |
Welcome Guest, Not a member yet? Register Sign In |