[eluser]thinkigniter[/eluser]
[quote author="dmyers" date="1229314311"]I decided to test WICK so I could add it to my bag of tricks but, the first test worked fine but, when I added it to my "generic" test application which has it's own controller (MY_Controller of course) I got a Fatal error:
Fatal error: Call to a member function checkaccess() on a non-object in /Applications/MAMP/htdocs/codeigniter170/system/application/libraries/MY_Controller.php on line 8
MY_Controller contains
class MY_Controller extends Controller {
function MY_Controller() {
parent::Controller();
$this->load->model('auth');
$this->auth->checkaccess();
}
}
So I am loading the controller right before the call?
If I call the welcome.php controller (via browser) which extends MY_Controller everything is fine.
but when I call more.php controller (via browser) which extends MY_Controller I get the error
class More extends MY_Controller {
function More() {
parent::MY_Controller();
}
function index() {
$this->load->library('Wick');
$this->wick->light('welcome/index');
//$data = array('pagename'=>'More');
//$this->load->view('welcome_message',$data);
}
}
class Welcome extends MY_Controller {
function Welcome() {
parent::MY_Controller();
}
function index() {
$data = array('pagename'=>'Welcome');
$this->load->view('welcome_message',$data);
}
}
class More extends MY_Controller {
function More() {
parent::MY_Controller();
}
function index() {
$this->load->library('Wick');
$this->wick->light('welcome/index');
//$data = array('pagename'=>'More');
//$this->load->view('welcome_message',$data);
}
}
I get the error.
The Auth model is
class Auth Extends Model {
function Auth() {
parent::Model();
$this->_auth = true;
}
function checkaccess() {
if ($this->_auth) return;
}
}
[/quote]
Is
refering to a variable that is not defined?
Try
Code:
class Auth Extends Model {
var $_auth = '';....
Also try changing
Code:
class Auth Extends Model {
to
Code:
class Auth extends Model {