Author: Peter Keung Date: 2007-01-13 00:07:17 +0100 (Sat, 13 Jan 2007) New Revision: 4498
Log: Edited eZ Components Base tutorial Modified: trunk/Base/docs/tutorial.txt Modified: trunk/Base/docs/tutorial.txt =================================================================== --- trunk/Base/docs/tutorial.txt 2007-01-12 22:35:36 UTC (rev 4497) +++ trunk/Base/docs/tutorial.txt 2007-01-12 23:07:17 UTC (rev 4498) @@ -6,22 +6,21 @@ Introduction ============ -The Base component provides the basic functionality that the components need to -function properly. As every other component depends on the Base package for -e.g. autoloading, the Base component needs to be loaded specifically. -Also Base provides way for autoloading external class repositories from -outside the eZ components. +The Base component provides the basic functionality, such as autoloading, that +all eZ Components need to function properly. The Base component needs to be +loaded specifically. Base can also autoload external class repositories from +outside the eZ Components. -Besides the autoload functionality the Base component also contains a number of +Aside from the autoload functionality, the Base component also contains a number of generic Exception classes that all inherit from the ezcBaseException class. Installation ============ -The installation and configuration of the eZ components environment is +The installation and configuration of the eZ Components environment is described in a separate article. Please refer to the `Components Introduction`_ -for instructions on installation and configuration of the eZ components library +for instructions on installation and configuration of the eZ Components library and the Base component. .. _Components Introduction: http://ez.no/community/articles/an_introduction_to_ez_components @@ -30,39 +29,39 @@ Usage ===== -Adding class repositories located outside eZ components to autoload system +Adding class repositories located outside eZ Components to autoload system -------------------------------------------------------------------------- -It can be useful to add repositories of user defined classes to the eZ -components autoload system. The ezcBase::addClassRepository() method can be -used to perform this task. At you need to arrange the desired external classes -in a class repository, i.e. make sure that classes and correspondent -\*_autoload.php files are named and placed accordingly to explanations below. -After they are in the proper structure you can call addClassRepository() with -the proper parameters somewhere in code before you use the external classes. +It can be useful to add repositories of user-defined classes to the eZ +Components autoload system. The ezcBase::addClassRepository() method can be +used to perform this task. You need to arrange the desired external classes +in a class repository. That is, make sure that classes and corresponding +\*_autoload.php files are named and placed according to the explanations below. +After they are in the proper structure, you can call addClassRepository() with +the proper parameters before you use the external classes. External classes will then be loaded by autoload system. ezcBase::addClassRepository() takes two arguments: - $basePath is the base path for the whole class repository. -- $autoloadDirPath the path where autoload files for this repository are found. +- $autoloadDirPath is the path where autoload files for this repository are found. The paths in the autoload files are *not* relative to the package directory -as specified by the $basePath argument. I.e. class definition files will -be searched for in the location $autoloadDirPath only. +as specified by the $basePath argument. In other words, class definition files will +only be searched for in the location $autoloadDirPath. -Example: -Take the following facts: +Consider the following example: - There is a class repository stored in the directory "./repos". -- Autoload files for that repository are stored in "./repos/autoloads". +- Autoload files for this repository are stored in "./repos/autoloads". - There are two components in this repository: "Me" and "You". - The "Me" component has the classes "erMyClass1" and "erMyClass2". - The "You" component has the classes "erYourClass1" and "erYourClass2". -In this case you need to create the following files in "./repos/autoloads". -Please note that the part before _autoload.php in the filename is the first -part of the classname, not considering the all lower-case letter prefix. +In this case, you need to create the following files in "./repos/autoloads". +Note that the prefix to _autoload.php in the filename is the first +part of the classname (although its first letter is uppercase for the +classname). Content of my_autoload.php: @@ -83,13 +82,13 @@ ./repos/You/yourclass1.php ./repos/You/yourclass2.php -To use this repository with the autoload mechanism you have to use the +To use this repository with the autoload mechanism, use the following code: .. include:: tutorial_example_01.php :literal: -The above code will result output: :: +The above code will output: :: Class 'erMyClass2' Class 'erYourClass1' -- svn-components mailing list [email protected] http://lists.ez.no/mailman/listinfo/svn-components
