Saturday 24 November 2007 1:17:40 am
eZ Publish 4 seems to have a eZcomponents-dedicated autoload built in. When I tried the autoload declaration: require_once "ezc/Base/base.php";
function __autoload( $className )
{
ezcBase::autoload( $className );
}
I got an error, because __autoload function had already been there, in /autoload.php: (...)
$baseEnabled = @include( 'ezc/Base/base.php' );
if ( !$baseEnabled )
{
$baseEnabled = @include( 'Base/src/base.php' );
}
define( 'EZCBASE_ENABLED', $baseEnabled );
function __autoload( $className )
{
static $ezpClasses = null;
if ( is_null( $ezpClasses ) )
{
$ezpKernelClasses = require 'autoload/ezp_kernel.php';
$ezpExtensionClasses = require 'autoload/ezp_extension.php';
$ezpClasses = array_merge( $ezpKernelClasses, $ezpExtensionClasses );
}
if ( array_key_exists( $className, $ezpClasses ) )
{
require( $ezpClasses[$className] );
}
elseif ( EZCBASE_ENABLED )
{
ezcBase::autoload( $className );
}
}
In result, no additional declaration in extension was required. Nice.
--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu
|