Page 1 of 1

autoLoading hierarchy

Posted: Wed May 18, 2011 10:44 am
by fabioDexus
I was browsing to opencart and thought that maybe it could use an autoload hierarchy, if all files obey some rules like:
ControllerName
We could write an autoload function and search the files.
Suppose that you have the checkout/cart and you load it now as something like $this->load->model('checkout/cart');
You could load it simply by calling new CheckoutCart()
And another concept that i guess would be interesting was a flexible hierarchy.

But suppose that you want it to load your custom cart that do something different so the autoload would search for
/yourFolder/checkout/cart.php first and then in catalog/checkout/cart.php if that wasn't found.
I don't know if it would run a little away from the simplicity proposal that is openCart but maybe would add a little more flexibility.