Part of the EllisLab Network
   
 
Cleanly Separate the CodeIgniter Code From My App Code
Posted: 05 July 2006 11:04 PM   [ Ignore ]  
Summer Student
Total Posts:  11
Joined  07-05-2006

I have been looking closely at CodeIgniter and really like what I see. One thing that I would like to see improved is the degree of separation between the CodeIgniter code and the application-specific code. The goal would be to be able to upgrade CodeIgniter to a new version by simply copying it into place, without any possibility of overwriting any of the custom application code. I view the current file organization as deficient in this respect. Then, I noticed that CakePHP has a very nice separation between the system code and app code.

Looking at the CodeIgniter source, this would not be terribly difficult to do. And I could do it myself, for instance. But unless it is done at the official release level, the benefits of easy upgrading won’t materialize and hence there is little reason to pursue that route.

Along these same lines, it would be nice if it were easier to extend/override the core functionality. I would like to see CodeIgniter look to some user-defined directories for helpers, scripts and plugins in addition to the standard directories.

I think the above additions would greatly improve the flexibility of CodeIgniter while remaining true to the poject’s core goals.

Anyone else with some thoughts on this?

Profile
 
 
Posted: 06 July 2006 12:59 AM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5968
Joined  11-23-2003

I don’t see this as a problem as long as CI stays backward compatible with newer versions.

Generally you keep your application code in the application folder, though you could put files outside that folder.  Examples would be your own core libraries. 

Couldn’t you manage all of this pretty well by keeping a separate folder structure that contains only the files that you change?

Also, I would think when you start changing the core of CI, you are making your problem worse.  When the time is right to update, you will have to test all your modifications to make sure nothing breaks.

Edit:  By the way, that last problem will be helped by the hooks the developers plan to place into the code.  That way you will be able to change the way CI works without actually changing the source code.

Profile
 
 
Posted: 06 July 2006 09:36 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  11
Joined  07-05-2006

Mirage’s post in this thread is very much what I was thinking. Again, easy enough to do. But, unless it is in the core, upgrading to new releases of CI becomes a chore. This is something that needs to be in the officially supported core release. There seem to be many users who desire this functionality. The requirements as I see them:

1) All core CI code in the system directory.
2) A separate directory for “vendor” code (libraries shared by multiple apps, but not part of CI core).
3) Any number of application directories, each with app-specific code.
4) The “vendor” and “app” directories must be able to live anywhere (preferably outside of the system directory).
5) All the above directories should be able to live outside of web root.
6) Should be able to invoke CI by including its main index.php file from a single index.php file that lives in web root.
7) A standard search methodology when including helpers/libraries/plugins/scripts that searches in order:
  a) the app directory
  b) the “vendor” directory
  c) finally, the CI core directory
until a matching file is found, thus allowing library files to override core files, and app-specific files to override library files.

Thoughts?

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120294 Total Logged-in Users: 48
Total Topics: 126411 Total Anonymous Users: 5
Total Replies: 664796 Total Guests: 381
Total Posts: 791207    
Members ( View Memberlist )