Modular Extensions - HMVC version 5.3 |
[eluser]jatin.soni[/eluser]
Hello, I am having trouble in loading model from sub modules. Here is some details. I am having few modules and sub-modules as below Code: modules/admin/ Each M/V/C has own files in it. Now I have created model in modules/admin/models/plugs/ just for testing purpose something like below Plugs Model Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); And now trying to load into Plugs Controller as below Code: <?php (defined('BASEPATH')) OR exit('No direct script access allowed'); Quote:An Error Was Encountered So than how to load model in controller?
[eluser]XMadMax[/eluser]
Hi jatin, I think the problem is a duplicate name in the loader, remember ever to have unique names for controllers and models: Rename Plugs (model) to Plugs_model, also rename the file as plugs_model.php Hope it helps, Xavier
[eluser]InsiteFX[/eluser]
Make sure you specifiy your module paths in the config.php file like below. Code: $config['modules_locations'] = array(
[eluser]redcloud80[/eluser]
Hi! I'm trying to use HMVC with my CI project but I'm stuck with path problems (I suppose!). This is my current application tree Code: - application MY_Controller.php file contains two classes Code: class MY_Controller extends CI_Controller and works when I try to reach domain.com/subcontrollers/first_controller Now I'd want to move all subcontrollers to modules for HMVC Code: - application but when I try to hit domain.com/subcontrollers/first_controller I get a class not found error. I tried to remove the subcontrollers dir level and force MY_Controller to extend MX_Controller instead of CI_Controller but both attempts were not working. Any suggestion? EDIT: Removing the subcontrollers dir and forcing MY_Controller to extend CI_Controller seems to work. This is the app tree Code: - application but how can I solve preserving the subcontrollers dir?
[eluser]ivantcholakov[/eluser]
@redcloud80 I use a modification of HMVC, anyway this might work: Code: - application/
[eluser]redcloud80[/eluser]
[quote author="ivantcholakov" date="1410629625"]@redcloud80 I use a modification of HMVC, anyway this might work: Code: - application/ Thanks, it works perfectly but it's not a good solution for me
[eluser]ivantcholakov[/eluser]
@redcloud80 Another way: Your last solution is possible too, but within routes.php you should write rules that insert the additional subdirectory segment. It is possible, somehow I don't like this way.
[eluser]ivantcholakov[/eluser]
The third way: Code: - application/ This is a possible implementation on my HMVC modification, you may check whether it works with the original one.
[eluser]redcloud80[/eluser]
[quote author="ivantcholakov" date="1410631479"]The third way: Code: - application/ This is a possible implementation on my HMVC modification, you may check whether it works with the original one.[/quote] This could work too but, unfortunately, I've just a single controller file for each controller... adding just another folder it's not a solution. Nice one though Maybe I'll go for the routes mapping solution.
[eluser]ivantcholakov[/eluser]
The radically new feature in the third way is "why_not_another_controller.php". It is not about a single controller within a single folder. Anyway, I am glad that you can figure out how to get to your solution. |
Welcome Guest, Not a member yet? Register Sign In |