Unable to load libraries when using CI 3 with HMVC |
I started a Modular project in CI2 (using HMVC). I am moving the project to CI 3.
I am trying to autoload the session library using config/autoload .php Code: $autoload['libraries'] = array('database','session'); I get this error: Code: Fatal error: Call to undefined method MY_Loader::_ci_load_class() in /srv/www/htdocs/projects/application/third_party/MX/Loader.php on line 158 Even if a manually load the library within the controller using $this->load->library('session'), i get the same error. I am convinced this is an error caused by using HMVC. I have managed to make CI 3 modular but I am stuck with this issue, please help... I can load helpers & models but I cant load libraries ![]()
Would you mind letting others know the solution that you have found?
Thanks in advance
Did you use the right version?
I am having no errors. https://bitbucket.org/wiredesignz/codeig...gniter-3.x (03-09-2015, 10:48 AM)frocco Wrote: Did you use the right version? Correct, this is the version that works with CI3. I had a wrong version. tnx! (03-09-2015, 12:32 PM)themban Wrote:(03-09-2015, 10:48 AM)frocco Wrote: Did you use the right version? can you share what are changes to add hmvc in CI3. i tryed it in CI2 but CI3 unable add hmvc it show page not found error
01-15-2016, 08:17 AM
(This post was last modified: 02-03-2016, 05:39 PM by edcoder. Edit Reason: Corrected the CI version and also made more clear the HMVC package used. )
I had to find a different solution since none of the previous suggestions worked for me...
I was using the older CI version (2x) but with the latest module class packages, the HMVC addon for CodeIgniter created by Wiredesignz, and I was still getting the error ![]() Fatal error: Call to undefined method MY_Loader::_ci_load_library() in C:\YourFileSystemHere\application\third_party\MX\Loader.php on line 173 So, out of frustration I decided to backtrack and dig around in the relevant third party files... I opened the file and went to line 173 and changed $this->_ci_load_library($library, $params, $object_name); to $this->_ci_load_class($library, $params, $object_name); to match the only loading class I could see in the parent class CI_Loader that would make sense. This removed the fatal error, but I still got an error saying In order to use the Session class you are required to set an encryption key in your config file. I then recalled previously coming across advice recommending NOT to leave the session encryption key empty in the config file. So I opened my config.php file and changed $config['encryption_key'] = ''; to $config['encryption_key'] = 'MustTypeSomethingHere'; And finally it worked! ![]() I hope this helps prevent some other poor soul from wasting unnecessary time and energy like I did. ![]() (01-15-2016, 08:17 AM)edcoder Wrote: I had to find a different solution since none of the previous suggestions worked for me... I upgraded 2.x to 3.x and replaced my system Directory with 3.x as per instructions. I get following error Error Message: Call to undefined method MY_Loader::_ci_load_class() Filename: /third_party/MX/Loader.php Line Number: 152. I already have _ci_load_class method called but it does not exist in /application/core/MY_Loader class. What did I miss ? THanks, Atul |
Welcome Guest, Not a member yet? Register Sign In |