[eluser]sailorob[/eluser]
I'd like to create my own boilerplate-esque classes and keep them nested cleanly within the directory structure.
For instance:
Quote:/libraries/Collection.php (base methods for a collection of items)
/libraries/Item.php (base methods for items)
/libraries/projects/Collection.php (extends ../Collection.php adding methods and whathaveyou)
/libraries/projects/Item.php (extends ../Items.php)
/libraries/users/Collection.php
/libraries/users/Item.php
I'm having rough go figuring out if I need the prefix "MY_" (or whatever I've configured it to), and if it's needed on both the class name, and file name for base classes. I am not extending CI's models as of now, just my own as seen above.
I can get the base classes to work, but not the extended classes. I don't think it's finding my base classes when I try to extend them. Are the sub-directories causing the issues? I am initializing like so:
Code:
$this->load->library('projects/Collection');
/libraries/Collection.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Collection {
protected $ids = NULL;
function __construct()
{
return $this;
}
public function load()...
/libraries/projects/Collection.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Collection extends Collection {
function __construct()
{
parent::__construct();
return $this;
}
}
Or am I trying to make CI do something it's not supposed to do?