Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Modular Extensions (HMVC) and MX_Controller Issues
#1

[eluser]phused[/eluser]
I have a CI application running with HMVC (Modular Extensions). I'm trying to extend the controller class to verify some user details before loading the controller. However, for some reason I cannot figure out why this extended class isn't loading.

I have the following code:

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MX_Controller extends Controller
{
    function __construct()
    {
        parent::Controller();
        
        echo 'Loading MX_Controller';
    }
}

/application/libraries/MX_Controller.php

Code:
<?php

class Workspaces extends MX_Controller {

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

/application/modules/app/controllers/workspaces.php

Any idea why this could be occurring/not working?
#2

[eluser]eoinmcg[/eluser]
Shouldn't it be?
Code:
<?php

class Workspaces extends MX_Controller {

    function __construct()
    {
        parent::MX_Controller();
#3

[eluser]phused[/eluser]
Oh crap! I totally forgot about that, thanks a lot!

I prefer using parent::__construct() instead of parent::MX_Controller(), both seem to work anyway.
#4

[eluser]eoinmcg[/eluser]
Yeah, much easier to use php5 constructor. Is anyone still using php4, anyway Tongue




Theme © iAndrew 2016 - Forum software by © MyBB