Why $CI =& get_instance(); in each function - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Why $CI =& get_instance(); in each function (/showthread.php?tid=46611) |
Why $CI =& get_instance(); in each function - El Forum - 11-08-2011 [eluser]TerryT[/eluser] I have a library where I call this in the constructor: Code: class Mypdf extends TCPDF I also have these methods: Code: public function newpdf($title, $subject, $report_name) To access sessions in either of the functions, I have to call: Code: $CI =& get_instance(); in each function. Can anyone let me know why I can't just call it in the parent::__construct()? Thanks. |