I have this error controller in my Codeigniter 2.1.0 application:
<?php
class Error extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
set_status_header(404);
$data->menuItems = Main::_menu();
$data->title = "404 error !";
$data->pageview = 'templates/404';
$this->load->view('templates/main', $data);
}
public function facebook()
{
set_status_header(404);
$data->menuItems = Main::_menu();
$data->title = "Facebook error !";
$data->pageview = "templates/facebook_error";
$this->load->view('templates/main', $data);
}
}
?>
The Maincontroller _menu:
<?php
class Main extends CI_Controller
{
// ... a lot of methods here ...
public static function _menu()
{
static $menuItems = array( //just a simple array
);
}
}
?>
facebook() method is totally the same as the index(), however index works fine, facebook() throw this message:
Fatal error: Class 'Main' not found in /var/www/MYApplicationName/application/controllers/error.php on line 22
How the earth is that possible ? How can I reach Main::_menu() from facebook() method ?