Welcome Guest, Not a member yet? Register   Sign In
creating more than one extension to a core library class
#1

[eluser]doehoe[/eluser]
I'm a bit of a newbie to CI , so please excuse any ignorance Wink

I understand that it is possible to extend the core classes (according to http://ellislab.com/codeigniter/user-gui...asses.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?
#2

[eluser]Adam Griffiths[/eluser]
Why can't you have multiple edits to the class in one file?
#3

[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.
#4

[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
class Input_one{}

class Input_two()
// controller
$input_one = new Input_one();
#5

[eluser]doehoe[/eluser]
Great! Thanks. Will try this out




Theme © iAndrew 2016 - Forum software by © MyBB