SEM Labs

Handcrafted Pixels, Code & Title Tags

Autoloading Classes

XFL

XFL requires a number of related classes to provide functionality for XFL elements, such as the XFL_Validate class. Rather than requiring each class every time you need it, you can use PHP's autoload feature to automatically load classes when objects are created.

Autoload documentation can be found in the PHP manual.

Example Using Autoload

The above __autoload function will explode called classes using the underscore and assume each underscore signifies a directory. This is the most popular way of using autoload. When using the above autoload function, calling the class XFL_Validate will require the file XFL/Validate.php.