Welcome Guest, Not a member yet? Register   Sign In
Unable to load the requested class
#7

[eluser]n0xie[/eluser]
[quote author="briang" date="1254588014"]OK, I think I understand the "MY_" prefix better now. It is only for extending native CI classes.

Other than that, library files do not need the prefix. Correct?

I was trying to (excuse my terminology) "double extend" the Controller.

Theoretically, I was trying to do this: "Auth extends MY_Controller extends Controller".
Was attempting this by creating an Auth.php that extends MY_Controller, while having the MY_Controller.php extend Controller. Then in application/controllers/, create a controller class 'New extends Auth', to gain a level of authentication.[/quote]
This can be achieved, but you have to let CI know where your Auth base controller is.

The 2 most methods is adding it to MY_Controller or adding an include in MY_Controller:
Code:
// method 1
// file: MY_Controller.php
class MY_Controller extends Controller {}
class Auth extends MY_Controller {}

// method 2
// file: MY_Controller.php
class MY_Controller extends Controller {}
include APPATH . '/libraries/auth.php';

// file: auth.php
class Auth extends MY_Controller {}

Once you have this in place you can build controllers like you would expect:

Code:
// admin.php in your controller folder
class Admin extends Auth {}

Hope this clears things up.


Messages In This Thread
Unable to load the requested class - by El Forum - 10-02-2009, 06:53 PM
Unable to load the requested class - by El Forum - 10-02-2009, 07:22 PM
Unable to load the requested class - by El Forum - 10-02-2009, 09:21 PM
Unable to load the requested class - by El Forum - 10-03-2009, 12:51 AM
Unable to load the requested class - by El Forum - 10-03-2009, 05:14 AM
Unable to load the requested class - by El Forum - 10-03-2009, 05:40 AM
Unable to load the requested class - by El Forum - 10-03-2009, 05:46 AM
Unable to load the requested class - by El Forum - 10-03-2009, 08:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB