CodeIgniter Forums
MVC to HMVC error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: MVC to HMVC error (/showthread.php?tid=62103)



MVC to HMVC error - tomop - 06-09-2015

Hi guys, I've created simple registration and login forms connected with database on my computer (using WAMP). It worked fine with MVC, I could register, login, logout etc. Now I'm starting to work with HMVC, using CI 3.0 and proper version of HMVC extension. I've created two modules - 'site' and 'login'. This is a part of my site controller:

Code:
<?php

class Site extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        modules::run('login/is_logged_in');
    }

    function members_area()
    {
        $this->load->view('logged_in_area');
    }

and this is my is_logged_in function located in a login controller:


Code:
function is_logged_in()
    {
        $is_logged_in = $this->session->userdata('is_logged_in');
        if(!isset($is_logged_in) || $is_logged_in != true)
        {
            echo 'You don\'t have permission to access this page. <a href="../login">Login</a>';    
            die();        
        }        
    }

the problem is that when I Log-In, I get an error message "Unable to locate the specified class: Session.php". If I comment-out
Code:
modules::run('login/is_logged_in');
it works just fine but there is no check if I am logged-in (I can access members_area without logging-in).

If someone could help me somehow, I'd be very thankful  Cool


RE: MVC to HMVC error - InsiteFX - 06-09-2015

You need to extend the MX_Controller.

PHP Code:
class Site extends MX_Controller {





RE: MVC to HMVC error - tomop - 06-10-2015

(06-09-2015, 10:50 PM)InsiteFX Wrote: You need to extend the MX_Controller.



PHP Code:
class Site extends MX_Controller {



Thanks a lot, solved.