Kiedys mialem tez taki problemy, najlepiej uzywac autoloaderow w klasie.
Oto przyklad mojego autoloadera ktory w przykladnie nizej laduje wszystkie pliki znajdujace sie w folderze app/class
Autoloader to helper.
class AutoLoad
{
private $path;
public function __construct($path)
{
$this->path = $path;
spl_autoload_register
(array($this, 'load')); }
function load($file)
{
if (is_file($this->path . '/' . $file . '.php')) { require_once($this->path . '/' . $file . '.php');
}
}
}
Sposob uzycia:
new AutoLoader('app/class');