Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]HMVC One module 2 controllers - Undefined property: Page::$db error
#1

[eluser]Cgull[/eluser]
Hello,

I am using CI 2.1.3

I am creating a module out of ion_auth.

Everything worked fine until I decided to create a different controller for user interaction.

I created a user module that extends Auth.

Auth extends MX contorller

In my user controller for testing purposes I have this:
Code:
class User extends Auth
{
public $data = array();

function __construct()
{
  parent::__construct();
}

function index()
{
            echo 'on';
        }
}

When I browse mysite/auth/user I get this error:

Message: Undefined property: Page::$db

Filename: libraries/Session.php

Line Number: 201

My folders:
application/modules/auth/controllers/
auth.php
user.php

Why do I get this error?

Everything works fine when I browse mysite/auth

Can someone please help?

Thank you
#2

[eluser]Cgull[/eluser]
Correction, I moved all the user functions back to the auth controller, and now I still get this error when calling auth/user_account

My function in the controller:
Code:
function user_account()
{
$data['user'] = $this->ion_auth->get_user($this->session->userdata('identity'));
$data['mainview'] = 'user/user_account';
        $data['meta_title'] = 'My Account';
$this->load->view('_main_layout', $data);
}
#3

[eluser]Cgull[/eluser]
I think I found the problem.

The function is calling a view that is out of the module.

And there was a page not found problem which sent the server to the default controller named page which extends a Frontend Controller which extends MY_Controller.

I change MY_Controller to extends MX_Controller and it seems fine now.

phew....




Theme © iAndrew 2016 - Forum software by © MyBB