Thanks, now everything works as expected! Regards, Simon
-----Ursprüngliche Nachricht----- Von: Alexandru Stanoi [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 19. Dezember 2007 15:12 An: Simon Wippich Cc: [email protected] Betreff: Re: [Components] Question on autoloading Simon Wippich wrote: > Hi all! > > I'm new to ezComponents and want to bulid an entire project upon that > impressive library. But I got stuck right at the beginning (it should be a > really trivial problem): the autoload of my controller class seems to be not > working. The only output I get is the following error message: > > "Fatal error: Class 'manappController' not found in > C:\Programme\xampp\htdocs\project\index.php on line 33" > > The development is taking place on a local XAMPP-server, ezc has been > installed via pear and is included correctly by the index.php. > > The filestructure: > > ./project/index.php > ./project/autoload/manapp_autoload.php > ./project/core/controller.php > > The content of the file index.php: > > <?php > > $ezcBase = "../../php/PEAR/ezc/Base/base.php"; > > // Check if the basefile exists > if(!file_exists($ezcBase)) { > die ("<h1>Error!</h1><p>The PEAR-package > <strong>eZComponents</strong> cannot be found! Please check your > installation...</p>"); } > > // Include the ezc-baseclass if available else { > require_once($ezcBase); > } > > ezcBase::addClassRepository( > dirname(__FILE__), > dirname(__FILE__) . "/autoload", > "manapp" > ); > > $options = new ezcBaseAutoloadOptions; > $options->preload = true; > ezcBase::setOptions($options); > > function __autoload($className){ > ezcBase::autoload($className); > } > > $manapp = manappController::getInstance(); $manapp->run(); > > ?> > > Content of the file manapp_autoload.php: > > <?php > > return array( > "manappController" => "core/controller.php", ); Hi Simon, Your autoload file should be named controller_autoload.php. Then it should work. See also the tutorial for the Base component (http://ezcomponents.org/docs/tutorials/Base), the section about adding class repositories located outside eZ Components to autoload system. In your case, "manapp" is something like a namespace (like "ezc" is for Components), and "Controller" is the name of your package. "manappController" is a class in the Controller package. If you add other classes to this package, they should be named "manappControllerSomething" and should be added to the controller_autoload.php file as well. Hope this helps. Cheers, Alex. -- Alexandru Stanoi eZ Components System Developer eZ Systems | http://ez.no -- Components mailing list [email protected] http://lists.ez.no/mailman/listinfo/components
