[eluser]bertcarremans[/eluser]
Hi,
I've been looking around in the forum to find a solution for my problem, but I could not find anything.
I want to do the following in the constructor function
Code:
function Site() {
parent::Controller();
session_start();
$data = array();
$this->data['last_models'] = $this->M_model->getLastModels();
}
And then later use it in a controller function home
Code:
function home() {
// Some code here ...
$data['last_models'] = $this->$data['last_models'];
// Some code here ...
}
Unfortunately, I get the following error
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: data
Is it not possible to use the (auto-loaded) model M_model in the constructor function?
Thanks!