• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.