Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - Libraries sometimes load, sometimes don't...
#1

[eluser]Gwarrior[/eluser]
I'm using the Modular Extension, which seems like it could be great if I could get it working, but alas I cannot.

I followed the instructions to install it to a 't', and it worked. The welcome page loaded correctly. I created another controller in the controller folder called home.php, and it too worked. I copy-and-pasted the contents of home.php into another controller in the same folder and named the file login.php, and adjusted all of the contents like class name to be Login. Now it errors - although the code is almost exactly the same!

I'm trying to call a library that's in the module/libraries folder that will load all of the required libraries, models and helpers I need.

Here is home.php:

Code:
<?php

class Home extends Controller {

    function __construct() {
        
        parent::__construct();    
        
        $this->load->library('cc_loader');
        
        $this->cc_loader->load_all();
        
    }

function index() {

$this->load->view('home');

}

}

This is login.php:

Code:
<?php

class Login extends Controller {

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

        $this->load->library('cc_loader');
        
        $this->cc_loader->load_all();
        
    }
    
    function index() {
        
        $this->load->view('home');
        
    }
    
}

Here is the error I get ONLY on login.php:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Login::$cc_loader

Filename: controllers/login.php

Line Number: 11

Fatal error: Call to a member function load_all() on a non-object in C:\wamp\www\cc_mod\system\application\modules\contentcreator\controllers\login.php on line 11


All I can say is WTF mate???
#2

[eluser]dudeami0[/eluser]
The controllers need to extend MX_Controller to use module extensions.
#3

[eluser]Gwarrior[/eluser]
Extending MX_Controller gives a memory leak:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261900 bytes) in C:\wamp\www\cc_mod\system\application\third_party\MX\Modules.php on line 287
#4

[eluser]dudeami0[/eluser]
Check for any recursive code, that's usually how you get up to the 128MB limit :p
#5

[eluser]Gwarrior[/eluser]
Well it turns out that I had a login model, and the names seemed to conflict.

Changed the name, and voila, worked!




Theme © iAndrew 2016 - Forum software by © MyBB