tutorial_autoload.php 501 B

123456789101112131415161718192021
  1. <?php
  2. $dir = dirname( __FILE__ );
  3. $dirParts = explode( DIRECTORY_SEPARATOR, $dir );
  4. switch ( $dirParts[count( $dirParts ) - 3] )
  5. {
  6. case 'doc': require_once 'ezc/Base/base.php'; break; // pear
  7. case 'trunk': require_once "$dir/../../../Base/src/base.php"; break; // svn
  8. default: require_once "$dir/../../../Base/src/base.php"; break; // bundle
  9. }
  10. /**
  11. * Autoload ezc classes
  12. *
  13. * @param string $className
  14. */
  15. function __autoload( $className )
  16. {
  17. ezcBase::autoload( $className );
  18. }
  19. ?>