I want to load a controller from a function in another controller because the library I integrated to my project I don't want to load it to the controller because I want to keep it clean and related.
I tried using modules but I still had to put controller in the url like
http://example.com/maincontroller/function
http://example.com/othercontroller/function
I have default controller so I can load http://example.com/function so how could I access the controller from a function from main so I don't have to put the controller in the url.
I'm still willing to use HMVC if I can load the controller function from the main controller function.
Codeigniter (and MVC in general) aren't designed to work this way. Controllers don't call other controllers. If you find yourself needing to do that it's likely an indicator that your app architecture needs some refactoring.
Show activity on this post. Create new Helper (e.g PermissionHelper. php ) then move the funtion to it and call it where you want using : PermissionHelper::permission();
yes you can (for version 2)
load like this inside your controller
$this->load->library('../controllers/whathever');
and call the following method:
$this->whathever->functioname();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With