• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to load libraries when using CI 3 with HMVC

#1
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 Sad
Reply

#2
Resolved, tnx to stackoverflow
Reply

#3
Would you mind letting others know the solution that you have found?
Thanks in advance
Reply

#4
Did you use the right version?
I am having no errors.

https://bitbucket.org/wiredesignz/codeig...gniter-3.x
Reply

#5
(03-09-2015, 09:26 AM)Kenneth_H Wrote: Would you mind letting others know the solution that you have found?
Thanks in advance

I was using a wrong version. Dodgy
Reply

#6
(03-09-2015, 10:48 AM)frocco Wrote: Did you use the right version?
I am having no errors.

https://bitbucket.org/wiredesignz/codeig...gniter-3.x

Correct, this is the version that works with CI3. I had a wrong version. tnx!
Reply

#7
(03-09-2015, 12:32 PM)themban Wrote:
(03-09-2015, 10:48 AM)frocco Wrote: Did you use the right version?
I am having no errors.

https://bitbucket.org/wiredesignz/codeig...gniter-3.x

Correct, this is the version that works with CI3. I had a wrong version. tnx!

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
Reply

#8
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 Huh :

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! Smile

I hope this helps prevent some other poor soul from wasting unnecessary time and energy like I did. Rolleyes
Reply

#9
(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 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 Huh :

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! Smile

I hope this helps prevent some other poor soul from wasting unnecessary time and energy like I did. Rolleyes

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
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.