don’t know if you already use this
function __autoload($class){
# autoloading of a class #
if (file_exists("classes/class.".$class.".php"))
include_once("classes/class.".$class.".php");
else print "Failed to auto-load classes/class.{$class}.php";
}
it’s a little snippet of PHP code who take care of autoloading a class when you try to use it and the relevant definition file hasn’t still been loaded.
As you can see, if you use a bit of naming convention and a solid file structure it could resolve many problems, expecially the neverending list of file inclusions at the beginning of your scripts.
Maybe some tweaks should be necessary to solve securiti issues, if you have any…
Tags: PHP, __autoload

Leave a Reply