CodeIgniter Forums
Modular Extensions - HMVC version 5.3 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Modular Extensions - HMVC version 5.3 (/showthread.php?tid=33523)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39


Modular Extensions - HMVC version 5.3 - El Forum - 10-03-2010

[eluser]wiredesignz[/eluser]
Then something else is wrong. Did you remove MY_Controller.php as per instructions? Are all your MY_ extension classes in the correct locations? Which version of CodeIgniter are you using? A little better explanation on your part would make diagnosis a damn sight easier.


Modular Extensions - HMVC version 5.3 - El Forum - 10-03-2010

[eluser]Vheissu[/eluser]
[quote author="wiredesignz" date="1286106446"]Then something else is wrong. Did you remove MY_Controller.php as per instructions? Are all your MY_ extension classes in the correct locations? Which version of CodeIgniter are you using? A little better explanation on your part would make diagnosis a damn sight easier.[/quote]

1. No MY_Controller or any other MY_ extensions of CI.
2. I am using the latest release of Codeigniter 2.0 from Bitbucket, I check for updates as it isn't a final release almost everyday.

Like I said, it works when you extend MX_Controller instead of just Controller even though I don't want to use HMVC. Not really that big of a issue to be honest. But sounds like others are experiencing the same thing.


Modular Extensions - HMVC version 5.3 - El Forum - 10-03-2010

[eluser]wiredesignz[/eluser]
You must have at least MY_Loader.php and MY_Router.php in application/core for CI 2.0


Modular Extensions - HMVC version 5.3 - El Forum - 10-03-2010

[eluser]Boris Strahija[/eluser]
I'm testing everything with the latest versions from Bitbucket, CI and ME. The problem was extending the MX_Controller class. I also tried removing MY_Controller, end extending the Controller class, works fine. Sorry about that, didn't read the wiki good enough Wink

About the backend segment, I don't it would be a good solution the way you suggested it. What would be the point in modules if I would have only 2 modules, backend and frontend? My goal is to have a module for each part of the backend (content, comments, newsletter, orders, ...), meaning that every module should have it's own folder. The way you suggest it, all the controllers would be in modules/backend/controllers. That's actually the default CI functionality Smile


Modular Extensions - HMVC version 5.3 - El Forum - 10-03-2010

[eluser]wiredesignz[/eluser]
If you need HMVC functionality then yes controllers extend MX_Controller.

About structure its not necessarily the CI way. HMVC allows modules controllers to call module controllers, so your functionality can still be split.

Or you could use routes if you are faint hearted. Good luck.


Modular Extensions - HMVC version 5.3 - El Forum - 10-03-2010

[eluser]Boris Strahija[/eluser]
What do you mean the funcionality can be split?

I could do it with routes but I would need to create a route for each module?


Modular Extensions - HMVC version 5.3 - El Forum - 10-03-2010

[eluser]Boris Strahija[/eluser]
I think I got it working with routes:
Code:
$route['default_controller'] = 'public';
$route['404_override'] = 'public';

$route['backend/([a-zA-Z_-]+)'] = "$1";
$route['backend/([a-zA-Z_-]+)/(:any)'] = "$1/$2";
$route['(:any)'] = 'public';

Do you think it's okay like this? Do you see any possible issues?


Modular Extensions - HMVC version 5.3 - El Forum - 10-05-2010

[eluser]ralf57[/eluser]
Hi all,
after reading a lot about the HMVC pattern I still fail to see the benefits over the traditional MVC pattern.
Also in the wiredesignz's Modular Extensions Wiki is stated that:

Quote:This is most useful when you need to load a view and its data within a view

Well, this is exactly what I want to avoid when implementing a view.
In my opinion a view should only contain the final output and "helpers" calls and should not load any data


Modular Extensions - HMVC version 5.3 - El Forum - 10-05-2010

[eluser]CoolGoose[/eluser]
Well the advantages are pretty huge actually.
Consider that you want to show a recent news block on some pages

Calling a function by hand in each page then passing the variable to the view, then passing the variable further to a view "partial" is a lot more ugly than just calling a module that shows only the recent news Smile


Modular Extensions - HMVC version 5.3 - El Forum - 10-05-2010

[eluser]Boris Strahija[/eluser]
I think the biggest advantage is organizing your code into modules. For eg. if you're building a CMS, you will most likely need a module for entering content. So you create 'modules/content', and inside folders 'controllers', 'libraries' etc. Now when you're working on the content part of your app, everything is one folder.
Also if you need to update a module on maybe another site it is much easier to update this one folder than to update every file separately.
There are some other things but this is enough for me to go the HMVC way Wink