CodeIgniter Forums
[SOLVED] Modular Extensions (HMVC) and MX_Controller Issues - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [SOLVED] Modular Extensions (HMVC) and MX_Controller Issues (/showthread.php?tid=28382)



[SOLVED] Modular Extensions (HMVC) and MX_Controller Issues - El Forum - 03-09-2010

[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?


[SOLVED] Modular Extensions (HMVC) and MX_Controller Issues - El Forum - 03-10-2010

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

class Workspaces extends MX_Controller {

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



[SOLVED] Modular Extensions (HMVC) and MX_Controller Issues - El Forum - 03-10-2010

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


[SOLVED] Modular Extensions (HMVC) and MX_Controller Issues - El Forum - 03-10-2010

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