![]() |
creating more than one extension to a core library class - 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: creating more than one extension to a core library class (/showthread.php?tid=12624) |
creating more than one extension to a core library class - El Forum - 10-25-2008 [eluser]doehoe[/eluser] I'm a bit of a newbie to CI , so please excuse any ignorance ![]() I understand that it is possible to extend the core classes (according to http://ellislab.com/codeigniter/user-guide/general/core_classes.html). However, what if you want to create more than one extension to the same class? As far as I see it, if we are using the Input class for example, since the subclass has to be named MY_Input we have no way of creating two different subclasses of Input. Is there a way around this, or is there a proper way of creating two or more subclasses of a core library class? creating more than one extension to a core library class - El Forum - 10-25-2008 [eluser]Adam Griffiths[/eluser] Why can't you have multiple edits to the class in one file? creating more than one extension to a core library class - El Forum - 10-27-2008 [eluser]dcunited08[/eluser] [quote author="Adam Griffiths" date="1224998073"]Why can't you have multiple edits to the class in one file?[/quote] This is currently what I do. I extend Controller in multiple ways and have them all in the same file. creating more than one extension to a core library class - El Forum - 10-27-2008 [eluser]xwero[/eluser] The MY_ prefix is to automatically load the extended library. I'm not sure if it will work but you can try to put the two extending classes in the MY_Input.php file and then you have to instantiate them yourself. Code: // MY_Input.php creating more than one extension to a core library class - El Forum - 10-27-2008 [eluser]doehoe[/eluser] Great! Thanks. Will try this out |