简体   繁体   中英

CodeIgniter HMVC load modules actions

I have CI project which have third_party library HMVC, and it's already in use. I was searching lots of, how to load modules action of it.. but can't find working, and i think that something is missing at my files..

so in HMVC i have 2 files: Loader.php and Router.php

Loader.php is HERE AND Router.php is HERE

and when i'm trying to load function of some of controllers ( $this -> load -> module('module_name'); ), I get error that function module can't be found. also i found that in with HMVC it could be loaded with model function ( $this -> load -> model('module_name'); ), but then i get error that module_name cannot be found.

so maybe someone could help me how to load module function from another module? (if it is possible)

PS I have in applincation folder, folder named modules in which there is some modules like user, admin and global. in user there is views, controllers folders and etc.. And i need for example to call function from users/services/index i need to call function which is in global/service/index . any suggestions?

First thing, from where you got the code for HMVC? According to me, there are more than 1 library available for CodeIgniter HMVC.

Second thing, the website from where you have downloaded the library, they create documentation regarding How to use it? .

I used CodeIgniter HMVC couple of time but never come accross with $this -> load -> module() .

Regarding $this -> load -> model('module_name') , it still works same as in codeigniter. But coming back to HMCV, if its local model, it should work as you have mentioned. If its from other module, then you need to code as $this -> load -> model('<module_name>/module_name') .

You can refer this link for more details.

You should not using same alias in your different models, maybe. i had same problem that solved with this solution. for example:

$this->load->model('modelNameA','aliasName');
$this->load->model('modelNameB','aliasName');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM