codeigniterhelper

CodeIgniter helper not loading


I was trying to use this helper to create a country drop down list.(https://github.com/EllisLab/CodeIgniter/wiki/helper-dropdown-country-code)

I created a file called country_helper.php with the helper code inside, in my controller I'm loading that helper with $this->load->helper('country_helper');

But when using country_dropdown(); I'm getting the following error:

Call to undefined function country_dropdown() in /Users/wouter/Sites/socialagent.me/application/controllers/user.php on line 299

Solution

  • class Welcome extends CI_Controller {
        public function __construct()
        {   
            parent::__construct();
            $this->load->helper('country_helper');
            echo country_dropdown();
        }   
        public function index()
        {
        }    
    }
    

    I tried this code, and it works fine.