CodeIgniter Forums

Full Version: MVC to HMVC error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
You need to extend the MX_Controller.

PHP Code:
class Site extends MX_Controller {


(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.