Question about (extending) Controllers - 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: Question about (extending) Controllers (/showthread.php?tid=40064) |
Question about (extending) Controllers - El Forum - 03-29-2011 [eluser]smilie[/eluser] Hi all! This is (most) probably a pure PHP question and not so much CI related. I am however stuck and would appreciate some help from you Oke, here we go (in steps): 1. Clean CI installation; 2. In a new Application directory placed: Code: abstract class CORE_Controller extends CI_Controller { ... } 3. Added REST Controller in the CI Core directory under libraries > Cpin2_rest.php: Code: class Cpin2_rest extends CI_Controller { ... } The problem. Ion Auth library is getting an instance of CI in constuctor with: $this->ci =& get_instance(); Then, in function logged_in() it does: Code: return (bool) $this->ci->session->userdata($identity); However, this produces error which states that 'session' is not known. If I do: Code: echo '<pre>'; print_r($this->ci); echo '</pre>'; exit; So - where did I took a wrong turn and is Rest controller now primary controller? Thanx! Cheers, Smilie Question about (extending) Controllers - El Forum - 03-30-2011 [eluser]smilie[/eluser] Found it, after a lot of debugging The order of loading libraries was incorrect whereby Cpin2_rest overtook $this instance Question about (extending) Controllers - El Forum - 03-30-2011 [eluser]Konfine[/eluser] Just a quick thing from me: $this->ci =& get_instance(); should be: $this->ci = get_instance(); http://forrst.com/posts/CodeIgniter_and_Object_References-tao |