How do I set up Codeigniter to handle multiple projects with a common ci base?

I've seen some CI implementations that claim you can put project folders in the apps folder for Codeigniter.

However, I have not been able to see this work as promised.

Here's what I did and what I would like to do - maybe you can help. For the argument, my document root is / www / (it doesn't, but let's use it for simplicity)

I put the core codeigniter at / www / corelib / codeigniter

I put the codeigniter system folder at / www / ci_system

I put my applications directory under / www / applications

I put my "entry point" into / www / dd

Now let's say I have two projects: "dataentry" and "cpanel"

Ideas are that I can go to

h ** p: // mydomain / dd / dataentry // for dataentry application and

h ** p: // mydomain / dd / cpanel // for cpanel application.

IF I organize my dataentry and cpanel directories like this:

/ Www / app / controllers / DataEntry

/ Www / app / controllers / cpanel

/ Www / app / model / DataEntry

/ Www / app / model / cpanel

/ Www / applications / views / DataEntry

/ Www / apps / views / cpanel

I can get this to work fine. However, what I would like to do is save the model and view at the same level as the controller so that I have the following:

/ Www / app / baabenba / controllers

/ Www / app / baabenba / models

/ Www / app / baabenba / species

/ Www / applications / cpanel / controllers

/ Www / applications / cpanel / models

/ Www / applications / cpanel / views

This does not work.

Any suggestions?

-CF

+2


source to share


2 answers


Okay - I work as I wish. I will try to write a more extensive "how to guide" and provide a link in the comments section.

I didn't have to change .htaccess any more than the CI required - I was happy with it. My records directory looks like this:

/dd/index.php

Two key parts:



list($blank, $webpath, $app) = explode('/', $_SERVER['REQUEST_URI']);
        $application_folder = $_SERVER['DOCUMENT_ROOT]."/applications/$app";

      

This allows one index.php to handle all applications.

The part I was missing is that the application name should now also be the main controller, or be a directory in the controllers. (The real problem I ran into was that I was hacking so hard that I had configurations and routes that prevented me from understanding what I was actually seeing: sometimes it is necessary to start cleaning.)

0


source


Each application ("dataentry" and "cpanel") has its own main index.php file which defines the corresponding $ application_folder?

Also - and I'm sure you read the docs, but the CodeIgniter Documentation states that the / applications directory (or directories, in your case) must exist in the / system directory like this:



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/

      

0


source







All Articles