[eluser]uber_n00b[/eluser]
I want to setup a variable to be used by various functions in my controller. I have viewed one of the posts on here that offered a few suggestions but it was dealing with strings and not arrays.
How can I make $timezone_drop; available to all functions in my class/controller?
Code:
$timezone_drop = array(
'' => 'Select Timezone',
1 => 'Eastern',
2 => 'Central',
3 => 'Mountain',
4 => 'Pacific',
5 => 'Alaskan',
6 => 'Hawaiian',
);
I have tried placing it in my construct function
Code:
function __construct()
{
parent::__construct();
$timezone_drop = array(
'' => 'Select Timezone',
1 => 'Eastern',
2 => 'Central',
3 => 'Mountain',
4 => 'Pacific',
5 => 'Alaskan',
6 => 'Hawaiian',
);
}
function index(){ $this->data['timezone'] = $timezone_drop; }
index() will throw an error saying $timezone_drop is undefined however if I place the variable declaration in index() it works fine.
Please help.
Thanks!