Author: dr
Date: Wed Feb 6 14:57:51 2008
New Revision: 7311
Log:
- Fixed issue #12449: Check spl_autoload_register and how to document it.
Modified:
docs/install.txt
Modified: docs/install.txt
==============================================================================
--- docs/install.txt [iso-8859-1] (original)
+++ docs/install.txt [iso-8859-1] Wed Feb 6 14:57:51 2008
@@ -195,7 +195,13 @@
autoload mechanism which can locate the classes for you when you instantiate or
use them otherwise.
-Therefore, you should add the following code on top of your PHP script::
+There are three different ways of getting the autoload mechanism going.
+
+Normal Autoload
+```````````````
+
+With the first method, you require the ezcBase class, and defined your own
+autoload mechanism. You should add the following code on top of your PHP
script::
<?php
require_once "Base/base.php"; // dependent on installation method, see
below
@@ -206,22 +212,49 @@
// your code here
?>
-The require_once statement is different depending on the installation method:
+Beware, that the require_once() statement is different depending on the
+installation method:
* PEAR Installer::
ezc/Base/base.php
-* Downloaded bundle::
+* Downloaded bundle and SVN::
Base/src/base.php
-* SVN::
-
- Base/src/base.php
-
-Do not forget to add these lines, otherwise the eZ Components will not function
-properly, because all of them use the autoload internally.
+Boot strap
+``````````
+In case you only have to use autoload for the eZ Components, and not for your
+application or another library, you can just simple include the
+``ezc_bootstrap.php`` file. Again, the file to require depends on the
+installation method.
+
+* PEAR Installer::
+
+ <?php
+ require 'ezc/Base/ezc_bootstrap.php';
+ ?>
+
+* Downloaded bundle and SVN::
+
+ <?php
+ require 'Base/src/ezc_bootstrap.php';
+ ?>
+
+SPL
+```
+SPL (Standard PHP Library) also allows autoloading to be set up through the
+spl_autoload_register_ function. In this case, you require() the base class,
+just like in the `Normal Autoload`_ method, but instead of defining an
+__autoload() function, you do::
+
+ <?php
+ spl_autoload_register( array( 'ezcBase', 'autoload' ) );
+ ?>
+
+.. _spl_autoload_register:
http://php.net/manual/en/function.spl-autoload-register.php
+
Conclusion
----------
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components