CodeIgniter Forums
Access variable from a helper - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Access variable from a helper (/thread-45519.html)

Access variable from a helper - El Forum - 09-24-2011

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",


$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