update docs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@319899 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Xinchen Hui 2011-11-26 05:13:58 +00:00
parent a6eeefbc0a
commit 71144c9e43

View file

@ -12,8 +12,71 @@
<section xml:id="yaf-loader.intro">
&reftitle.intro;
<para>
<classname>Yaf_Loader</classname> introduces a comprehensive autoloading
solution for Yaf.
</para>
<para>
The first time an instance of <classname>Yaf_Application</classname> is retrieved,
<classname>Yaf_Loader</classname> will instance a singleton, and registers itself with
spl_autoload. You retrieve an instance using the <methodname>Yaf_Loader::getInstance</methodname>
</para>
<para>
By default, <classname>Yaf_Loader</classname> assume all Class will store
in the <link linkend="yaf.configuration">global class
directory</link>, which is defined in the php.ini(yaf.library).
</para>
<para>
If you want <classname>Yaf_Loader</classname> search some Class in the
<link linkend="yaf-loader.props.library">local class
directory</link>(which is defined in application.ini, and by default,
it is APPLICATION_PATH . "/libraray"), you should register the class prefix using the
<methodname>Yaf_Loader::registerLocalNameSpace</methodname>
</para>
<para>
<programlisting role="php">
<![CDATA[
// Assuming the following configure in php.ini:
yaf.libraray = "/global_dir"
//Assuming the following configure in application.ini
application.libraray = APPLICATION_PATH "/library"
//Assuming the following local name space registerd:
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract{
public function _initLoader($dispatcher) {
Yaf_Loader::getInstance()->registerLocalNameSpace(array("Foo", "Bar"));
}
?>
]]>
</programlisting>
then the autoload examples:
<programlisting role="bash">
<![CDATA[
class Foo_Bar_Test =>
// APPLICATION_PATH/library/Foo/Bar/Test.php
class GLO_Name =>
// /global_dir/Glo/Name.php
//as of PHP 5.3, you can use namespace
class \Foo\Bar\Dummy =>
// APPLICATION_PATH/library/Foo/Bar/Dummy.php
class \FooBar\Bar\Dummy =>
// /global_dir/FooBar/Bar/Dummy.php
]]>
</programlisting>
</para>
<para>
You may noticed that all the folder is Ucfisted, you can make them all
lowcase by set yaf.lowcase_path = On in php.ini
</para>
</section>
<!-- }}} -->
@ -71,7 +134,11 @@
<varlistentry xml:id="yaf-loader.props.library">
<term><varname>_library</varname></term>
<listitem>
<para></para>
<para>
By default, this value is APPLICATION_PATH . "/library", you can change
this either in the application.ini(application.library) or call to
<methodname>Yaf_Loader::setLibraryPath</methodname>
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="yaf-loader.props.global-library">
@ -92,6 +159,7 @@
</partintro>
&reference.yaf.entities.yaf-loader;