[eluser]Jeroen Brussich[/eluser]
Hello,
I'm new @ CI and I'm already loving it.
Being new though, I struggle with some basic CI concepts (I think).
Let's say I have a dummy class.
Code:
class Dummy Extends Controller {
function __construct()
{
Parent::Controller();
$this->data['foo'] = 'bar';
}
function index()
{
print $this->data['foo']; //works
}
function doStuff()
{
print $this->data['foo'] //works
$this->data['number'] = 1;
print $this->data['number']; //works
}
function doSomethingElse()
{
print $this->data['foo'] //works
print $this->data['number']; //fails
}
}
For some reason I can print $this->data['foo'] in all functions but $this->data['number'] only in the function I declared it.
Is there a way to make $this->data['number'] globally available in all my functions, just as $this->data['foo'] is, without declaring it in the __construct?
Thanks in advance.