Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 1 | ########################## |
| 2 | Managing your Applications |
| 3 | ########################## |
| 4 | |
| 5 | By default it is assumed that you only intend to use CodeIgniter to |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 6 | manage one application, which you will build in your *application/* |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 7 | directory. It is possible, however, to have multiple sets of |
| 8 | applications that share a single CodeIgniter installation, or even to |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 9 | rename or relocate your application directory. |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 10 | |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 11 | Renaming the Application Directory |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 12 | ================================== |
| 13 | |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 14 | If you would like to rename your application directory you may do so |
| 15 | as long as you open your main index.php file and set its name using |
| 16 | the ``$application_folder`` variable:: |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 17 | |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 18 | $application_folder = 'application'; |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 19 | |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 20 | Relocating your Application Directory |
| 21 | ===================================== |
| 22 | |
| 23 | It is possible to move your application directory to a different |
| 24 | location on your server than your system directory. To do so open |
| 25 | your main index.php and set a *full server path* in the |
| 26 | ``$application_folder`` variable:: |
| 27 | |
| 28 | $application_folder = '/path/to/your/application'; |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 29 | |
| 30 | Running Multiple Applications with one CodeIgniter Installation |
| 31 | =============================================================== |
| 32 | |
| 33 | If you would like to share a common CodeIgniter installation to manage |
| 34 | several different applications simply put all of the directories located |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 35 | inside your application directory into their own sub-directory. |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 36 | |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 37 | For example, let's say you want to create two applications, named "foo" |
| 38 | and "bar". You could structure your application directories like this:: |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 39 | |
Derek Jones | a1360ef | 2011-10-05 17:22:53 -0500 | [diff] [blame] | 40 | applications/foo/ |
| 41 | applications/foo/config/ |
| 42 | applications/foo/controllers/ |
| 43 | applications/foo/errors/ |
| 44 | applications/foo/libraries/ |
| 45 | applications/foo/models/ |
| 46 | applications/foo/views/ |
| 47 | applications/bar/ |
| 48 | applications/bar/config/ |
| 49 | applications/bar/controllers/ |
| 50 | applications/bar/errors/ |
| 51 | applications/bar/libraries/ |
| 52 | applications/bar/models/ |
| 53 | applications/bar/views/ |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 54 | |
| 55 | To select a particular application for use requires that you open your |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 56 | main index.php file and set the ``$application_folder`` variable. For |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 57 | example, to select the "foo" application for use you would do this:: |
| 58 | |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 59 | $application_folder = 'applications/foo'; |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 60 | |
| 61 | .. note:: Each of your applications will need its own index.php file |
| 62 | which calls the desired application. The index.php file can be named |
Andrey Andreev | 16a704c | 2012-11-09 17:25:00 +0200 | [diff] [blame] | 63 | anything you want. |