If I extend below file OR just autoload it in autoload.php all I get is http 500 and sometimes empty output. MYControllerInterface.php is located under application/libraries .
I’ve chmod’ed the whole directory (recursivly) to 0777. I’ve created a .htaccess with RewriteEngine On and Off in the root directory.
I’ve commented out everything from { to } in MYcontrollerInterface…
I’ve tried removed the ending ?>
I’ve checked that mod_rewrite is enabled in php config… This is so mysterious!
<?php
class MYcontrollerInterface extends CI_Controller {
public function __construct() {
parent::__construct();
//$this->load->helper('url');
}
function build_page($main_content_view, $data) {
/*
$this->load->view('header', $data);
//$this->load->view('content', $data);
//$this->load->view($main_content_view, $data, true);
$this->load->view('footer', $data);
*/
echo 'apa';
}
}
/* End of file MycontrollerInterface.php */
/* Location: ./application/controllers/MYcontrollerInterface.php */
?>
application/logs/log-2012-04-12.php :
DEBUG - 2012-04-12 13:21:22 --> Config Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Hooks Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Utf8 Class Initialized
DEBUG - 2012-04-12 13:21:22 --> UTF-8 Support Enabled
DEBUG - 2012-04-12 13:21:22 --> URI Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Router Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Output Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Security Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Input Class Initialized
below keeps repeating:
DEBUG - 2012-04-12 13:21:22 --> Global POST and COOKIE data sanitized
DEBUG - 2012-04-12 13:21:22 --> Language Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Loader Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Controller Class Initialized
DEBUG - 2012-04-12 13:21:22 --> Final output sent to browser
DEBUG - 2012-04-12 13:21:22 --> Total execution time: 0.0320
DEBUG - 2012-04-12 13:21:38 --> Config Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Hooks Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Utf8 Class Initialized
DEBUG - 2012-04-12 13:21:38 --> UTF-8 Support Enabled
DEBUG - 2012-04-12 13:21:38 --> URI Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Router Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Output Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Security Class Initialized
DEBUG - 2012-04-12 13:21:38 --> Input Class Initialized
If you are extending a controller (which is a core class) it needs to go in /application/core.
Also check your prefix, the CI2 standard is MY_ (check your $config[‘subclass_prefix’] at line 109).
UPDATE An extended controller must be called MY_Controller (as per the loader class).
You would then use it like…