Can a Library extend the CI_Base class? |
[eluser]laytone[/eluser]
Can I extend the CI_Base class in a library? Will this make my CI objects available in the $this-> variable?
[eluser]techgnome[/eluser]
It's in the documentation: http://ellislab.com/codeigniter/user-gui...asses.html
[eluser]laytone[/eluser]
[quote author="techgnome" date="1291340484"]It's in the documentation: http://ellislab.com/codeigniter/user-gui...asses.html[/quote] Maybe my question was not clear? I know how to extend the core classes. What I want to do is extend the CI_Base class with a class in my library folder. Right now if you want to access variable in CI you have to use the =& get_instance() method... which is fine, just extra work. I'm wondering if i could extend CI_Base and access the CI variables with $this->db or $this->whatever. Is this legal?
[eluser]WanWizard[/eluser]
You can extend any class, but you'll just be creating another instance of that class, you'll still have to use get_instance(), or assign all properties to the CI object to your new class manually.
[eluser]laytone[/eluser]
[quote author="WanWizard" date="1291341550"]You can extend any class, but you'll just be creating another instance of that class, you'll still have to use get_instance(), or assign all properties to the CI object to your new class manually.[/quote] I understand, and that makes a lot of sense. Thank you. |
Welcome Guest, Not a member yet? Register Sign In |