phpcodeignitersessioncodeigniter-hmvc

Codeigniter Session Library - HMVC


I ran into a problem, while coding around in CI 3.0.3 and latest HMVC Extension. I'm autoloading some libraries, helpers and much more. The Session library too. Now i have a few controllers all working fine, except one.

In that controller i use this code:

modules::run($module->module . '/' . $module->controller . '/' . $module->method, unserialize($block->configuration));

While using this static function i got the error:

Unable to locate the specified class: Session.php

The log says that the Session class is initialized.

INFO - 2015-12-01 09:41:40 --> Session: Class initialized using 'database' driver.

Any ideas why i got this error?

EDIT: -----------------------------------------------------------------------

To prevent stupid answers as below ...

In CI we can’t call more than 1 controller per request. Therefore, to achieve HMVC, we have to simulate controllers. It can be done with libraries, or with this “Modular Extensions HMVC” contribution.

The differences between using a library and a “Modular HMVC” HMVC class is: 1. No need to get and use the CI instance within an HMVC class 2. HMVC classes are stored in a modules directory as opposed to the libraries directory.

EDIT 2: ---------------------------------------------------------------------

For further questions:


Solution

  • Simple.

    If you want to load a controller in a controller use:

    Modules::load();
    

    or outsource the Modules::run(); into a view that is loaded by the main controller.

    Simple.