Salman Iqbal Salman Iqbal - 5 months ago 98
PHP Question

How to load ion auth model in codeigniter HMVC

I am using the ion auth library for the CodeIgniter HMVC, I have copied all files from ion auth library to main CodeIgniter files but the controller, model, and views files copy to module directory Now it's showing me this error.

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Auth::$ion_auth_model

Filename: libraries/Ion_auth.php

Line Number: 122


File: /opt/lampp/htdocs/CI_Hmvc/application/libraries/Ion_auth.php
Line: 122 Function: _error_handler

File: /opt/lampp/htdocs/CI_Hmvc/application/libraries/Ion_auth.php
Line: 70 Function: __get

File: /opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php
Line: 173 Function: _ci_load_library

File: /opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php
Line: 192 Function: library

File: /opt/lampp/htdocs/CI_Hmvc/application/third_party/MX/Loader.php
Line: 153 Function: libraries

Line: 9 Function: library

File: /opt/lampp/htdocs/CI_Hmvc/index.php Line: 315 Function:

could anybody tell me how to load the model, when I work as modules?

Answer Source

I believe the problem is that the library is not finding the model. Check inside ion auth library construct. Look for the line where it says


It should be line 122 since that's where the error is ocurring. In here you need to prefix the module name - where you have the ion_auth_model - to the model path so the loader class knows where to find it.

In your case if the module's name is directory, then 'directory/ion_auth_model'.

Check this solution, point 10, last item. Hope it helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download