Part of the EllisLab Network
   
2 of 2
2
CI Modular or HMVC
Posted: 22 June 2009 04:14 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  06-19-2009

Well since it is dug up anyway, may as well capitalize on it!

Can someone explain the difference between HMVC and MVC and what ‘module’ is referring to in this context?

 Signature 

———
Life is full of surprises so don’t scream so loud next time one jumps out at you!

-Me cheese


Respect the penguin ~ Love the penguin ~ Be the penguin ... It is your friend!


Twitter: Follow Me

Profile
 
 
Posted: 22 June 2009 04:18 PM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  202
Joined  12-31-2007

H = Hierarchical, meaning the MVC (Models-Views-Controllers) are located within a hierarchy (aka modules)
HMVC allows you to do something like this

/application/modules/forum/models/forum_model.php
/application/modules/forum/controllers/forum.php
/application/modules/forum/views/thread.php

/application/modules/poll/controllers/poll.php
/application/modules/poll/views/options.php

Therefore, your application is more portable.

Profile
 
 
Posted: 22 June 2009 04:22 PM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  06-19-2009

I can see how it makes them more independent, but doesn’t that make code less re-usable?

 Signature 

———
Life is full of surprises so don’t scream so loud next time one jumps out at you!

-Me cheese


Respect the penguin ~ Love the penguin ~ Be the penguin ... It is your friend!


Twitter: Follow Me

Profile
 
 
Posted: 22 June 2009 04:24 PM   [ Ignore ]   [ # 19 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  202
Joined  12-31-2007

I’m not sure how it could make it less re-usable.

I think that Matchbox/HMVC simply alters CodeIgniter’s lookup chain; Everything works like a vanilla-CI does. I could be wrong though.

Profile
 
 
Posted: 22 June 2009 04:47 PM   [ Ignore ]   [ # 20 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  06-19-2009

What I mean by less re-usable is that lets say you have function X() that does something with users and that is in the polls module.  Now in the forum module you need to do the exact same thing.  In order to make the two portable you would have to have two copy’s of the function one for each module thus sacrificing re-usability for portability.

Someone correct me if I am wrong!

 Signature 

———
Life is full of surprises so don’t scream so loud next time one jumps out at you!

-Me cheese


Respect the penguin ~ Love the penguin ~ Be the penguin ... It is your friend!


Twitter: Follow Me

Profile
 
 
Posted: 26 June 2009 06:14 AM   [ Ignore ]   [ # 21 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  768
Joined  09-01-2007

It dosn’t mean every possible problem can be made re-usable, but say you made an Asset Library and put it in a module. If it was made so it didn’t rely on anything else than you can drop it in and out.

Now I personally use modules for a better separation. In BackendPro I use it to separate out most of the code so the application dir is left for the user to add their controllers without all the ‘gubins’ cluttering it up. It then means by seperate parts of the application are in nice manageable chunks.

 Signature 

Kaydoo - A day in the life of a developer
BackendPro Control Panel

Profile
 
 
Posted: 26 June 2009 06:31 AM   [ Ignore ]   [ # 22 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2503
Joined  06-11-2007

Don’t forget you can still put libraries and models in the root folders for easy sharing and Matchbox can use syntax like $this->load->module_model(‘modulename’, ‘modelname’); anyway. All code is still accessible just separated better.

 Signature 

Blog | Twitter | GitHub
————————-
CodeIgniter 2: Everything you need to know
————————
PyroCMS - open source modular CMS built with CodeIgniter
CleverAndy - get money for un-used concept designs
————————
Libraries: Asset, Cache, cURL, CLI, REST, Template

Profile
 
 
Posted: 28 June 2009 08:51 PM   [ Ignore ]   [ # 23 ]  
Lab Technician
RankRankRankRank
Total Posts:  1242
Joined  04-19-2008
painting753 - 28 June 2009 10:47 AM

this something that’s not in the CI masterplan? I know, we can use Modular Extensions or Matchbox, but I was just wondering if it’s something you’re planning as a structural part of CI itself.

Thanks & Regards

Yani


Picture to Painting
Photo to portrait

copied from the OP: http://codeigniter.com/forums/viewthread/84883/

 Signature 

PinoyTech - Web Development Blog

Profile
 
 
   
2 of 2
2
 
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: 120000 Total Logged-in Users: 58
Total Topics: 126131 Total Anonymous Users: 1
Total Replies: 663477 Total Guests: 474
Total Posts: 789608    
Members ( View Memberlist )