CodeIgniter Forums
Controller Instanciation - 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: Controller Instanciation (/showthread.php?tid=52879)



Controller Instanciation - El Forum - 06-30-2012

[eluser]Unknown[/eluser]
I am new to CodeIgniter . But not new to OOPs . My doubt is very simple. We extend class from the ci_controller. ( for example myOwnController extends CI_Controller ) but we do not instanciate the class to make an object by using the normal 'new' key word. But still it is functioning.

I read about the super object.Is it because the super object CI does the instanciation for us ?
So the 'new' key word ( Like:- $myConObject = new myOwnController("myParam"); ) is not needed in CodeIgniter ? Does the super object singleton is taking care of all these ? What is the benefit of this ? Is this something specific for CodeIgniter alone or similar things are there in other platforms also ? As per my understanding, if a class is created its object has to be instaciated to use the method or property , unless the method or property is static. Will any body please give me a reply ?

Nasir, Kerala India : [email protected]


Controller Instanciation - El Forum - 06-30-2012

[eluser]CroNiX[/eluser]
CI instantiates the controller depending on the url. Check out the /system/core/CodeIgniter.php file to learn how CI loads/processes requests. That file gets loaded from the bottom of index.php after all of the paths are defined.