Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

CUSTOM_AUTOLOAD_MECHANISM

Summary

Custom Autoload Mechanism

Description

It is also possible to push a custom autoload method to the autoload function stack. Remember to check for class prefixes in such a method, if it will not serve classes from eZ Publish and eZ Components.Here is an example code snippet to be placed right in this file, in the case you would be using your custom Foo framework, in which all PHP classes would be prefixed by 'Foo':

ini_set( 'include_path', ini_get( 'include_path' ). ':/usr/lib/FooFramework/' );
require 'Foo/ClassLoader.php';
 
function fooAutoload( $className )
{
    if ( 'Foo' == substr( $className, 0, 3 ) )
    {
        FooClassLoader::loadClass( $className );
    }
}
 
spl_autoload_register( 'fooAutoload' );

Andrea Melo (21/06/2012 3:47 pm)

Andrea Melo (22/06/2012 10:06 am)


Comments

There are no comments.