• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loading a helper in a library

I wrote my own DateForm library that creates HTML dropdowns of the months and days. I tried to do $this->load->helper('form') in its constructor but an error was given saying "load" was not defined. I suppose this is because only controllers are allowed to load helpers. But isn't it cumbersome to have to load the form helper every time I want to load my DateForm library?

library class...
   private $ci;

   function __construct()
       $this->ci =& get_instance();
       if (! function_exists(form_open))

This should allow your DateForm library to be independent, and will load the form helper on its own if it isn't already loaded.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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