Welcome Guest, Not a member yet? Register   Sign In
extending libraries
#2

[eluser]slowgary[/eluser]
CodeIgniter only loads files that you tell it to load. You'll likely need to do something like this:
Code:
$this->load->library('parent');
$this->load->library('extends_parent');

$this->extends_parent->parent_method();

If, however, you only ever plan to use the libraries together you could just put them both in one file:
Code:
<?php
// this file is apple.php
class Apple extends Fruit
{
}

class Fruit
{
}

Now in your controller (or wherever you need to use these, you can just load the Apples class and you'll also be loading class Fruit. Alternatively, if you plan to have many different classes that extend Fruit (like Oranges, Bananas, Pineapples) but you don't want to load the Fruit class everytime, you can throw the Fruit class into your autoload.php config file or just require_once('fruit.php') in each of the classes that extends it.

I hope this helps.


Messages In This Thread
extending libraries - by El Forum - 09-07-2010, 02:42 PM
extending libraries - by El Forum - 09-07-2010, 05:28 PM
extending libraries - by El Forum - 09-07-2010, 09:04 PM
extending libraries - by El Forum - 09-08-2010, 10:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB