[eluser]RogerMore[/eluser]
Ok people,
I have a problem I can't get solved and I'm out of idea's.
On the net I found an implementation to use MY_Controller for multiple controllers.
I used this for my project to make a Base controller which extends from controller, and a Front and Admin controller which extend form the Base controller.
So far so good. Worked like a charm... but when I moved my project from my local installation (XAMPP) to a hosted server the problems began.
At first I got a white page, and firebug gave me an '
500 Internal server error'.
After checking my config etc. I checked the serverlogs which give me the following message:
-
PHP Fatal error: Class 'Public_Controller' not found in /home/httpd/.../application/controllers/SomeForm.php on line 3
Running my code locally was never a problem. Below I will add simplified code of the begin the controller code and also the MY_Controller which doesn't seem to work anymore. I almost forgot to mention that I'm running CI version 1.7.3
If anyone can help me how fix this, I would be most gratefull..
Thanks,
Roger
My controller:
Code:
<?php
class SomeForm extends Public_Controller {
function SomeForm()
{
parent::Public_Controller();
$this->load->library('lib');
$this->load->model('some_model');
}
...
My MY_Controller:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Base_Controller extends Controller {
function Base_Controller() {
parent::Controller();
// begin of fireignition stuff
// ..
// end of fireignition stuff
}
}
class Admin_Controller extends Base_Controller {
function Admin_Controller() {
parent::Controller();
// for future use
}
}
class Public_Controller extends Base_Controller {
public function Public_Controller() {
parent::Controller();
define('STUFF', 'defining some stuff');
$this->lang->load('language', language_code);
//valide and define more stuff
$this->_validate();
}
function _validate() {
// do validation
$validateThis = $this->uri->segment(3);
if (!$validateThis) {
die('an error!');
} else { // if there's something to validate..
// do some db stuff
// nog record found, die with an error
if ($query->num_rows() == 0) {
die("another error");
} else {
// else get row with data
$omgArr = $query->row_array();
// and define some more stuff
define('SOMEMORESTUFF', $omgArr['stuff']);
}
}
}
}
?>