Part of the EllisLab Network
   
1 of 24
1
Modular Separation (deprecated by Matchbox)
Posted: 07 November 2006 02:54 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  492
Joined  06-16-2006

Hi there, a couple of you have been asking for a way of keeping assosiated views/controllers/models in the same folder. I don’t know if anyones made it yet, but I thought I’d share mine (it’s not commented or anything - it was just intended to be of my own use).

Modular Separation has been deprecated by Matchbox. However, Matchbox is backwards compatible with its predecessor so you can switch over without problems.

 Signature 

Best regards, Zacharias.
Matchbox - Modular Separation | Wick - Controller Loader

Profile
 
 
Posted: 07 November 2006 02:54 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  492
Joined  06-16-2006

See the Wiki Page for documentation.

 Signature 

Best regards, Zacharias.
Matchbox - Modular Separation | Wick - Controller Loader

Profile
 
 
Posted: 07 November 2006 06:31 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
RankRankRank
Total Posts:  915
Joined  07-10-2006

Very nice and I will play with your contribution tonight. Elliot did something similar for the CodeIgnition CMS project on svn. I think his solution was developed for 1.4.1 and is being upgraded to 1.5.x. For your reference, you might want to take a look at what he did.

Profile
 
 
Posted: 08 November 2006 04:48 AM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  254
Joined  10-04-2006

Excuse me to interrupt the discussion grin but I do not understand interest of this thing. I think I missed something perhaps relevant.
Could you explain me why you want to keep this stuff in the same folder ?

Thanks

 Signature 

Sylvain Gourvil
PHP Developer
French scuba divingMotivation and team building

Profile
 
 
Posted: 08 November 2006 06:20 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  492
Joined  06-16-2006

Well. In most cases you wouldn’t smile But if you’re developing something you’d like to share, or some sort of module based application where you’d like people to pick just the parts they like, etc. they would only need to drop in a folder, instead of copying the assosiated files into different folders. As a bonus, it’s also easier to get rid of the modules smile ... But really, not many people will need this.

 Signature 

Best regards, Zacharias.
Matchbox - Modular Separation | Wick - Controller Loader

Profile
 
 
Posted: 08 November 2006 08:05 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  254
Joined  10-04-2006

ok, I understand now wink

I keep it in mind in case.
thx

 Signature 

Sylvain Gourvil
PHP Developer
French scuba divingMotivation and team building

Profile
 
 
Posted: 08 November 2006 08:10 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
Joined  09-24-2006
dynazack - 07 November 2006 02:54 PM

The files should be placed in the following folders:

/system/application/modules/controllers/MODULENAME/controllers/
/system/application/modules/controllers/MODULENAME/models/
/system/application/modules/controllers/MODULENAME/views/

Hi dynazack, great contribution smile. Wouldn’t it make more sense if the folder structure for modules was like below? I don’t understand why the modules sit within an extra directory called ‘controllers’


/system/application/modules/MODULENAME/controllers/
/
system/application/modules/MODULENAME/models/
/
system/application/modules/MODULENAME/views/

Profile
 
 
Posted: 09 November 2006 07:55 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  492
Joined  06-16-2006

Ooops, actually thats how it already is. It went a little fast explaining the fodler structure. I’ll edit it right away. I’d be great if some people would try it out just so i know it works.

 Signature 

Best regards, Zacharias.
Matchbox - Modular Separation | Wick - Controller Loader

Profile
 
 
Posted: 09 November 2006 10:08 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
Joined  09-24-2006

Thanks dynazack for the contribution, i’ll keep you posted on how it goes wink

Profile
 
 
Posted: 11 November 2006 11:46 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
Joined  09-24-2006

Hi again dynazack. Been trying to use your libraries but Im having some trouble implementing them.

Firstly I’m using PHP4 and I don’t understand this step:

/system/codeigniter/Base4.php
...

class CI_Base extends MY_Loader {

...

That is, replacing CI_Loader with MY_Loader.


I changed it so that CI_Base extends MY_Loader but then it complains “MY_Loader doesn’t exist…”.

Secondly, I’ve got the MY_Loader and MY_Router files under my application/cms/libraries/ folder and I’ve loaded the libraries into my Controller constructor and I get “Unable to load the class MY_Router…”.

What am I doing wrong?

Thanks in advance:)

Profile
 
 
Posted: 13 November 2006 02:06 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  492
Joined  06-16-2006

First of all, MY_Libraries are extended base libraries. Therefore, MY_Loader and MY_Router goes in and does a few changes to the native CI mechanics. Base libraries that are loaded automaticly (including Loader and Router) does not need to be loaded in a controller, and neither does their extensions. smile So, you do not need to load those libraries.

That it complains about not being able to find MY_Loader is strange. Since youve put em in the application/cms/libraries, are you sure you have set the correct application path in your index.php file? This whole solution shouldn’t need any configuration at all, only that little bug fix with PHP4. Thanks for telling me this, please tell me if there is still problems.

 Signature 

Best regards, Zacharias.
Matchbox - Modular Separation | Wick - Controller Loader

Profile
 
 
   
1 of 24
1
 
     YATS -- The Layout Library ››
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 719, on June 06, 2008 10:16 AM
Total Registered Members: 64453 Total Logged-in Users: 16
Total Topics: 80960 Total Anonymous Users: 1
Total Replies: 435691 Total Guests: 178
Total Posts: 516651    
Members ( View Memberlist )