<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 343887 $ -->

<refentry xml:id="yaf-loader.registernamespace" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>Yaf_Loader::registerNamespace</refname>
  <refpurpose>Register namespace with searching path</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <modifier>public</modifier> <type>bool</type><methodname>Yaf_Loader::registerNamespace</methodname>
   <methodparam><type class="union"><type>string</type><type>array</type></type><parameter>namespaces</parameter></methodparam>
   <methodparam choice="opt"><type>string</type><parameter>path</parameter></methodparam>
  </methodsynopsis>
  <para>
   Register a namespace with searching path, <classname>Yaf_Loader</classname>
   searchs classes under this namespace in path, the one is also could be 
   configureded via <link linkend="configuration.yaf.library.namespace">
   application.library.directory.namespace</link>(in application.ini);
  </para>
  <para>
   <note>
    <para>
      Yaf still think underline as folder separator.
    </para>
   </note>
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>namespace</parameter></term>
    <listitem>
     <para>
      a string of namespace, or a array of namespaces with paths.
     </para>
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>path</parameter></term>
    <listitem>
     <para>
      a string of path, it is better to use abosolute path here for performance
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   bool
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <example>
   <title><function>Yaf_Loader::registerNamespace</function>example</title>
   <programlisting role="php">
<![CDATA[
<?php
$loader = Yaf_Loader::getInstance();
$loader->registerNamespace("\Vendor\PHP", "/var/lib/php");
$loader->registerNamespace(array(
     "\Vendor\ASP" => "/var/lib/asp",
     "\Vendor\JSP" => "/usr/lib/vendor/",
));

$loader->autoload("\Vendor\PHP\Dummy");   //load '/var/lib/php/Dummy.php'
$loader->autoload("\Vendor\PHP\Foo_Bar"); //load '/var/lib/php/Foo/Bar.php'
$loader->autoload("\Vendor\JSP\Dummy");   //load '/usr/lib/vendor/Dummy.php'

?>
]]>
   </programlisting>
  </example>
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
