Welcome Guest, Not a member yet? Register   Sign In
Access variable from a helper
#1

[eluser]Unknown[/eluser]
I have a state list array that I would like to drop in a helper.
This is pretty much just static data and should not need to be put in a function for what I want to do with it.

How do I access the helper variable?

Helper File:

$state_list = array('AL'=>"Alabama",
'AK'=>"Alaska");


Controller:

$this->load->helper('state_helper'); // File name State_helper.php in helpers folder verified it gets called.

Read Var in controller:

echo ('-- '.$this->state_helper->state_list['AL']); // NO

echo ('-- '.$this->state_list['AL']); // NO

echo ('-- '.$state_list['AL']); // NO




Theme © iAndrew 2016 - Forum software by © MyBB