Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:08:59+00:00 2026-06-14T05:08:59+00:00

I created a core controller named Role_Admin and set the config prefix $config[‘subclass_prefix’] =

  • 0

I created a core controller named Role_Admin and set the config prefix

$config['subclass_prefix'] = 'Role_';

Here is the code for the Role_Admin.php in the core folder

class Role_Admin extends CI_Controller {
    function __construct() {

    }
}

In the controller folder when I write

class admin extends Role_Admin { ... }

I get

Fatal error: Class ‘Role_Admin’ not found

Is something wrong in what I am doing.

edit: (i created a quick fix that is much better, any new core file that you create just extend the MY_Controller. Then in your controller directory you can extend any Core controller that you created

class MY_Controller extends CI_Controller {

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

            //include custom core classes
            $core_path = DOCUMENT_ROOT . '/application/core';
            $this->load->helper('file');

            foreach(get_filenames($core_path) as $file) {
                if ($file != 'MY_Controller.php') {
                    if(file_exists($file)) {
                        include_once($file);
                    }
                }
            }
        }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:09:00+00:00Added an answer on June 14, 2026 at 5:09 am

    The setting you have for $config['subclass_prefix'] is fine, but your file name is incorrect. CI is looking for the file Role_Controller.php, not Role_Admin.php.

    There’s an easier way to do this, and although it might appear to be a hack it is totally legit. Go back to the MY_ prefix, create MY_Controller.php, and in that file, just define the controller classes you want to use. You actually don’t even need a MY_Controller class. Example:

    // application/core/MY_Controller.php
    class Role_Admin extends CI_Controller {}
    class AnotherClass extends Role_Admin {}
    class SomeOtherClass extends AnotherClass {}
    

    All these classes will be available for your controllers to extend.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITableView set up with a Core Data fetched results controller and
I created an iPhone project using the Core Data template. Now when I try
So I created a custom text view using core graphics and have it conformed
I have created a Class Library (Core Processing Component) using C# in Visual Studio
I've created a bare git repository (Core), cloned from a pre-existing repo (Production) using
I have created a graph using core plot. Graph is shown in on the
My app uses Core Data, I used the CoreData template when created my project
There is something I dont understand in core data. I have created a NSManagedDocument,
I'm currently migrating my sqllite application to using core data. When I created the
I did some little experimentation on this. I created an boolean attribute, named isFault.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.