CodeIgniter Forums
Modular Extensions - HMVC version 5.4 - 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.4 (/showthread.php?tid=38057)

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


Modular Extensions - HMVC version 5.4 - El Forum - 04-05-2011

[eluser]wiredesignz[/eluser]
@darkhouse, You could try using a catchall route sending everything to your default controller and use the _remap() method to sort out the URL.
Code:
$route['(.*)'] = $route['default_controller'].'$1';



Modular Extensions - HMVC version 5.4 - El Forum - 04-06-2011

[eluser]manik005[/eluser]
hi `m new to hmvc pattern.. could u guide me how to integrate it with CI2.0


Modular Extensions - HMVC version 5.4 - El Forum - 04-06-2011

[eluser]InsiteFX[/eluser]
Did you read the article on HMVC in the WIKI? That explains how to set it up and use it.

HMVC

InsiteFX


Modular Extensions - HMVC version 5.4 - El Forum - 04-06-2011

[eluser]manik005[/eluser]
@InsiteFX,
thnx for ur reply :-)
actually i was converting my application to hmvc. In my application i had a small tweak in MY_router.php . it made me to stumble upon the hmvc installation. now i altered my old my_router.php compatible with HMVC extension. now everything works like charm. Thnx for ur assist :-)


Modular Extensions - HMVC version 5.4 - El Forum - 04-06-2011

[eluser]darkhouse[/eluser]
@wiredesignz: Yeah, I really wanted to stay away from that. I don't want to have to add manual routing for every controller each time.

I ended up going through the code and adding a quick fix that seems to be working very well. The only issue is that when you have an update, I'll have to modify the code again. Here's what I did.

In application/third_party/MX/Modules.php on roughly line 92, in the load method, I changed to
Code:
list($class) = CI::$APP->router->locate($segments, true);

In application/third_party/MX/Router.php on roughly line 63, the locate method, I changed to
Code:
public function locate($segments, $get_module=false) {

Then still in that file, on roughly line 79, I changed to
Code:
list($module, $directory, $controller) = array_pad($segments, 3, NULL);
        
if($get_module !== false){
            
    foreach (Modules::$locations as $location => $offset) {

And added the corresponding close bracket on roughly line 114, right after the foreach closes.

And finally, in application/core/MY_Router.php on roughly lines 32 and 33 I changed to
Code:
public function locate($segments, $get_module=false){
    if($located = parent::locate($segments, $get_module)) return $located;

And I believe that's it. The only other thing I'd like to do is make it a config option so that I can turn the feature on an off for different projects, but I'll worry about that later.


Modular Extensions - HMVC version 5.4 - El Forum - 04-20-2011

[eluser]wilso417[/eluser]
Is it possible to extend the lang library? I tried dropping application/libraries/MY_Lang.php with: class MY_Lang extends MX_Lang {... and it did not work. I was following the instructions on the ME site "All MY_ extension libraries should include (require) their equivalent MX library file and extend their equivalent MX_ class".

Looking through the ME code it looks like it never looks for a MY_Lang file, how can I have it search for this first? Can any MX libraries be extended?


Modular Extensions - HMVC version 5.4 - El Forum - 04-20-2011

[eluser]osci[/eluser]
drop it in core for ci2.


Modular Extensions - HMVC version 5.4 - El Forum - 04-20-2011

[eluser]wilso417[/eluser]
Also, why when I make a controller that is extended from MX_Controller it will auto-load items in my autoload config but when I extend from CI_Controller it will not?

I am refering to just application/config/autoload.php


Modular Extensions - HMVC version 5.4 - El Forum - 04-20-2011

[eluser]wilso417[/eluser]
osci,

when I do that I get the error:

Fatal error: Class 'CI_Controller' not found in D:\Development\intranet_new\system\core\CodeIgniter.php on line 231


Modular Extensions - HMVC version 5.4 - El Forum - 04-21-2011

[eluser]manik005[/eluser]
@wilso417 ,
did u dropped ur MY_lang file inside the "application\core"