1

I am using CodeIgniter 3 with wiredesignz HMVC.

I have a controller that renders a view. If I call Modules::run('OtherModule/Controller/Action) from within that view, it shows the following message at the bottom:

Unable to locate the specified class: Session.php

Session is included in the auto-load configuration and works fine in all controllers without references to controllers in other modules. Removing the Modules::run() statement gets rid of the error and the referenced method is an empty dummy, so the error must come from Modules::run() itself.

Google shows a few similar questions but none have been answered. Hopefully someone has figured it out since the last time it was asked. Help is greatly appreciated! Thanks in advance!

Gentle153
  • 327
  • 2
  • 5
  • 15
  • Make sure your controller file has first letter upper case for class and file name. –  Feb 25 '16 at 21:07

1 Answers1

3

I finally figured it out! The controller I tried to call extended MY_Controller, which extended CI_Controller directly. Apparently this works fine for calling methods through the URL, but MX_Controller needs to be extended for Modules::run() to work. Making MY_Controller MX_Controller instead solved the problem.

I was assuming that I made MY_Controller extend MX_Controller when I created it and it didn't occur to me to check that. Apparently that is a mistake more people make, and now the solution is finally documented.

Gentle153
  • 327
  • 2
  • 5
  • 15