Codeigniter cannot call core class
<p>I'm trying to call my core controller class in <code>application/core</code> from my child controller in <code>application/controllers</code>. I have <code>Home</code> controller <code>home.php</code> in <code>application/controllers</code> that extends <code>Public_Controller</code> in <code>application/core</code>. My <code>home.php</code> is like this:</p>
<pre><code>&lt;?php
class Home extends Public_Controller
{
    public $data = array(
        'page' =&gt; 'home',
        'main_view' =&gt; 'home'
    );

    public function index()
    {
        $this-&gt;load-&gt;view($this-&gt;layout, $this-&gt;data);
    }
}
</code></pre>
<p>in the core folder, I have public_controller.php</p>
<pre><code>&lt;?php
class Public_Controller extends MY_Controller
{
    // Layout untuk &quot;Publik&quot;
    public $layout = 'layout';
}
</code></pre>
<p>From the code above, MY_Controller also located in core. here's the code</p>
<pre><code>&lt;?php
class MY_Controller extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        // Autoload model.
        $model = strtolower(get_class($this));
        if (file_exists(APPPATH . 'models/' . $model . '_model.php')) {
            $this-&gt;load-&gt;model($model . '_model', $model);
        }
    }
}
</code></pre>
<p>So, in summary i have controllers <code>home</code> in <code>application/controllers</code> that extends <code>public_controller</code> in <code>application/core</code> and the <code>public_controller</code> extends <code>my_controller</code> that also in <code>application/core</code>.
I already modified config/config.php by adding this code</p>
<pre><code>function __autoload($class)
{
    if(strpos($class, 'CI_') !== 0)
    {
        @include_once( APPPATH . 'core/'. $class . EXT );
    }
}
</code></pre>
<p>so I can connect base controllers to controllers by reference from this <a href="https://philsturgeon.uk/codeigniter/2010/02/08/CodeIgniter-Base-Classes-Keeping-it-DRY/" rel="nofollow noreferrer">https://philsturgeon.uk/codeigniter/2010/02/08/CodeIgniter-Base-Classes-Keeping-it-DRY/</a></p>
<p>But it's still not working. Saying that</p>
<blockquote>
<p>Fatal error: Class 'Public_Controller' not found in
C:\xampp\htdocs\cipsb\application\controllers\home.php on line 2</p>
</blockquote>
<p>Is there anything I can do for solving this problem?
Thank you</p>