• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MVC to HMVC error

#1
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
Reply

#2
You need to extend the MX_Controller.

PHP Code:
class Site extends MX_Controller {


What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.