• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post sheet

#4
(12-13-2014, 06:59 AM)InsiteFX Wrote: If your using a class library then you need to access external methods using the CI Super Object.


Code:
class yourClass
{
   private $_ci;

   public function __construct()
   {
       parent:: __construct();

       $this->_ci = get_instance();
   }
}

// access db and models using $this->_ci->db->get() etc;

This code will trigger a fatal error. There's no 'parent' to call when you don't extend anything.
Reply


Messages In This Thread
Post sheet - by juninhodeluca - 12-13-2014, 05:54 AM
RE: Post sheet - by InsiteFX - 12-13-2014, 06:59 AM
RE: Post sheet - by Narf - 12-14-2014, 08:49 AM
RE: Post sheet - by Rufnex - 12-13-2014, 07:49 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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