CodeIgniter Forums
Multiple applications on single CI install - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Multiple applications on single CI install (/thread-14737.html)



Multiple applications on single CI install - El Forum - 01-13-2009

[eluser]Unknown[/eluser]
I've been fiddling around with the idea of setting up a site with multiple apps. I.e., I'd have a 'Main' app, a 'blog' app, 'forum', and so on. Each app would have its own controllers, models, and libraries, as well as access to global libraries & models directories.

Directory structure is currently like this:


Code:
root
/applications
  /libraries (global)
  /models (global)
  /main (default app loaded when going to www.domain.com)
    /config
    /controllers
    /errors
    /helpers
    /hooks
    /language
    /libraries
    /models
    /views
  /blog  (would be reached through www.domain.com/blog/)
    /config
    /controllers
    /errors
    /helpers
    /hooks
    /language
    /libraries
    /models
    /views
  /forum  (see above)
    /config
    /controllers
    /errors
    /helpers
    /hooks
    /language
    /libraries
    /models
    /views
/htdocs
  /images (global images used across templates)
  /js  (global scripts)
  /style (global css)
  /templates
    /default
      /images
      /js
      /style
    /blog
      /images
      /js
      /style
    /forum (you get the idea)
/libraries
   /codeigniter
   /any other libraries I might use
/logs

Now, everything is setup this way and works fine, except that I need a way for codeigniter to recognize that when a user types in www.domain.com/blog or /forum, it switches apps. Is this possible?

Edit: I should also clarify just in case, the htdocs folder and subfolders are the only publicly accessible folders. Everything else is below the webroot for security reasons.


Multiple applications on single CI install - El Forum - 01-14-2009

[eluser]Phil Sturgeon[/eluser]
Why not just use Matchbox?

It is doing essentially what you have here, but means you don't need to set up a new application for each new section you make, and makes loading your global resources, etc much easier.