Will Codeigniter work for my needs?

#1
[eluser]Unknown[/eluser]
I think CodeIgniter looks super easy to develop with. It really looks like a great framework. But there's one thing that really bothers me. I hope someone can clarify this, but if not, I just don't think its going to work.

It just doesn't seem like CI has a flexible enough file/application structure. It seems like CodeIgniter is specifically intended to be used entirely under the public document root, and that a single CI application is intended to contain the public files, all the application code, and the CI library itself below the docroot.

On the other hand, I prefer to build my applications such that a) application files are kept separate from the app's public docroot; b) application files and the app's public docroot are each kept separate from the framework's core files; and c) multiple applications can exist, separately, outside of the public docroot, which are each launched from a separate path within the docroot or even a separate docroot altogether, YET all use the same framework core, and may even share model classes and possibly even certain controllers.

For instance, consider this structure:
Code:
/web
    /libs
        /codeigniter
        /swiftmailer
    /apps
        /common
            /controllers
            /models
        /myblog
        /forum
        /cms
        /project-manager
    /html
        /mydomain1.com
            /blog
                /index.php   --> points to the "myblog" app
            /community
                /index.php   --> points to the "forum" app
            /index.php       -->  points to the "cms" app
        /projects.mydomain2.com
            /index.php       --> points to the "project-manager" app

I've started working with Zend, which allows me to setup a much more flexible structure like the one I've described. However, Zend is pretty bloated and has what seems to be to be a lot of unnecessary setup for simple applications.

So I guess my question is, IS this possible without serious modification of core files, and how?

Thanks.

#2
[eluser]BrianDHall[/eluser]
Actually with nothing more than a change to two lines in index.php (the front controller) you can move Everything other than index.php out of the document root. You can of course for simplicity leave an images, css, js, etc folder in public root of course Smile

All you need is this (and love):

Code:
/*
|---------------------------------------------------------------
| SYSTEM FOLDER NAME
|---------------------------------------------------------------
|
| This variable must contain the name of your "system" folder.
| Include the path if the folder is not in the same  directory
| as this file.
|
| NO TRAILING SLASH!
|
*/
    $system_folder = "../system";

/*
|---------------------------------------------------------------
| APPLICATION FOLDER NAME
|---------------------------------------------------------------
|
| If you want this front controller to use a different "application"
| folder then the default one you can set its name here. The folder
| can also be renamed or relocated anywhere on your server.
| For more info please see the user guide:
| http://ellislab.com/codeigniter/user-guide/general/managing_apps.html
|
|
| NO TRAILING SLASH!
|
*/
    $application_folder = "../application";

So you can rip the application folder out of system (which I always do) and put it anywhere on your server your server allows and feel free to rename it, and then rename or move the system folder and do the same thing.

I rename my sytem folder into ci_version_number and share it with all my applications. I have 4 running off 1 CI system folder so far, no problems.

It is easiest to leave the internals of 'system' and 'application' alone for simplicity, but some surely could be changed, but not need to.

You can, using this simple index.php method, do almost exactly what you want to do.

For the 'common' folder arrangement, that I haven't tried. Some people just use symlinks for this, but there might be another way - I just prefer to leave well enough alone Smile

#3
[eluser]ChazUK[/eluser]
I was also looking to do something like what creatorbri has described.

I would describe it as having site containing different subsystems, like music.site.com, sport.site.com, entertainment.site.com. But then the controllers, models and views could be very different.
Sharing configs (unless overwritten in apps folder), errors, helpers, hooks and libraries so that I don't have to copy all of them across different apps within the same website.

However I look at it, I don't think CI can accommodate this.

#4
[eluser]Clooner[/eluser]
[quote author="ChazUK" date="1270673258"]I was also looking to do something like what creatorbri has described.

I would describe it as having site containing different subsystems, like music.site.com, sport.site.com, entertainment.site.com. But then the controllers, models and views could be very different.
Sharing configs (unless overwritten in apps folder), errors, helpers, hooks and libraries so that I don't have to copy all of them across different apps within the same website.

However I look at it, I don't think CI can accommodate this.[/quote]

It is actually really easy to setup something like that... Simply detect the current url in the config and load it accordingly...

#5
[eluser]ChazUK[/eluser]
[quote author="clooner" date="1270677513"]
It is actually really easy to setup something like that... Simply detect the current url in the config and load it accordingly...[/quote]
So how would I go about having a centralised libraries folder?

The only thing that will differ between the sites would be the routes, controllers, models and views. (most probably)

#6
[eluser]n0xie[/eluser]
[quote author="ChazUK" date="1270678021"][quote author="clooner" date="1270677513"]
It is actually really easy to setup something like that... Simply detect the current url in the config and load it accordingly...[/quote]
So how would I go about having a centralised libraries folder?

The only thing that will differ between the sites would be the routes, controllers, models and views. (most probably)[/quote]
The new CodeIgniter 2.0 will make sharing of common libraries much easier. You can do it now using symlinks or absolute paths to a common library directory.

#7
[eluser]ChazUK[/eluser]
What's the expected release date of CI 2.0?

#8
[eluser]n0xie[/eluser]
That's the million dollar question!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.