Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter: Librariy class not loading with this code
    primarykey
    data
    text
    <p>I am new to CodeIgniter and following one Nettuts premium tutorial how to build CMS in codeigniter.</p> <p>Very first my <strong>application</strong> and <strong>system</strong> directories lies on different path out of public_html and set path in config.php file.</p> <p>I have created two files Frontend_Controller.php and Admin_Controller.php and within those files created class as below.</p> <p><strong>application/My_Controller.php</strong></p> <pre><code>class MY_Controller extends CI_Controller { public $data = array(); function __construct() { parent::__construct(); $this-&gt;data['errors'] = array(); $this-&gt;data['site_name'] = config_item('site_name'); } } </code></pre> <p><strong>libraries/Frontend_Controller.php</strong></p> <pre><code>class Frontend_Controller extends MY_Controller { function __construct() { parent::__construct(); } } </code></pre> <p><strong>libraries/Admin_Controller.php</strong></p> <pre><code>class Admin_Controller extends MY_Controller { function __construct() { parent::__construct(); } } </code></pre> <p>Now when I am trying to autoload above classes by writing an __autoload() function into config.php file but it doesn't load the files/classes</p> <p><strong>config.php</strong> </p> <pre><code>function __autoload($classname) { if(strpos($classname, 'CI_' !== 0)) { $file = APPPATH . 'libraries/' . $classname . '.php'; if(file_exists($file) &amp;&amp; is_file($file)) { @include_once($file); } } } </code></pre> <p>Can anyone help me to understand and resolve the issue... Thanks a lot</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload