Skip to content

Multiple Applications

World Wide Web Server edited this page Jul 4, 2012 · 26 revisions

[size=5][color=blue]Managing Multiple Applications[/color][/size]

CodeIgniter is distributed with one application in mind, but is ready to accommodate multiple applications on a given site. However, because the [color=blue]/application/[/color] folder is inside of the [color=blue]/system/[/color] folder, this leads some to think you need to have multiple installations of the system files. Let's look at how this can be done.

Support for multiple applications is simply a matter of: [code]

  • having multiple application folders
  • having one front controller (index.php) per application, or some other crafty way of mimicking this. [/code]

Let's start by reviewing CodeIgniter's default file layout (as of v1.5.3). When you download the distribution and extract the archive, you end up with this layout: [code] CodeIgniter_x.x.x/ license.txt -- the usage licence agreement index.php -- your front controller, to be installed in the webroot of your site. system/ -- this is where the magic is user_guide/ -- a copy of the User Guide for offline/local reference [/code]

For the following examples, we'll create two applications.

  1. a [b]frontend[/b] application (public site)
  2. a [b]backend[/b] application (admin site)

[size=4][color=red]Method #1 - Application Subfolders[/color][/size]

Inside the [color=blue]/system/[/color] folder lives the [color]/application/[/color], by default. The User Guide describes a technique for having multiple applications by following this process.

Duplicate the contents of your [color=blue]/application/[/color] folder, and put the copies into separate subfolders, so you may end up with this layout: [code] /system/application/ /frontend/ /backend/ [color]

Clone this wiki locally