reference/yaf/yaf_loader/registernamespace.xml
16a1bdfd1c36108534b5af08dc4b751c7ac0fdaf
...
...
@@ -0,0 +1,106 @@
1
+
<?xml version="1.0" encoding="utf-8"?>
2
+
<!-- $Revision: 343887 $ -->
3
+

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

10
+
<refsect1 role="description">
11
+
&reftitle.description;
12
+
<methodsynopsis>
13
+
<modifier>public</modifier> <type>bool</type><methodname>Yaf_Loader::registerNamespace</methodname>
14
+
<methodparam><type class="union"><type>string</type><type>array</type></type><parameter>namespaces</parameter></methodparam>
15
+
<methodparam choice="opt"><type>string</type><parameter>path</parameter></methodparam>
16
+
</methodsynopsis>
17
+
<para>
18
+
Register a namespace with searching path, <classname>Yaf_Loader</classname>
19
+
searchs classes under this namespace in path, the one is also could be
20
+
configureded via <link linkend="configuration.yaf.library.namespace">
21
+
application.library.directory.namespace</link>(in application.ini);
22
+
</para>
23
+
<para>
24
+
<note>
25
+
<para>
26
+
Yaf still think underline as folder separator.
27
+
</para>
28
+
</note>
29
+
</para>
30
+
</refsect1>
31
+

32
+
<refsect1 role="parameters">
33
+
&reftitle.parameters;
34
+
<variablelist>
35
+
<varlistentry>
36
+
<term><parameter>namespace</parameter></term>
37
+
<listitem>
38
+
<para>
39
+
a string of namespace, or a array of namespaces with paths.
40
+
</para>
41
+
</listitem>
42
+
</varlistentry>
43
+
<varlistentry>
44
+
<term><parameter>path</parameter></term>
45
+
<listitem>
46
+
<para>
47
+
a string of path, it is better to use abosolute path here for performance
48
+
</para>
49
+
</listitem>
50
+
</varlistentry>
51
+
</variablelist>
52
+
</refsect1>
53
+

54
+
<refsect1 role="returnvalues">
55
+
&reftitle.returnvalues;
56
+
<para>
57
+
bool
58
+
</para>
59
+
</refsect1>
60
+

61
+
<refsect1 role="examples">
62
+
&reftitle.examples;
63
+
<example>
64
+
<title><function>Yaf_Loader::registerNamespace</function>example</title>
65
+
<programlisting role="php">
66
+
<![CDATA[
67
+
<?php
68
+
$loader = Yaf_Loader::getInstance();
69
+
$loader->registerNamespace("\Vendor\PHP", "/var/lib/php");
70
+
$loader->registerNamespace(array(
71
+
"\Vendor\ASP" => "/var/lib/asp",
72
+
"\Vendor\JSP" => "/usr/lib/vendor/",
73
+
));
74
+

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

79
+
?>
80
+
]]>
81
+
</programlisting>
82
+
</example>
83
+
</refsect1>
84
+

85
+
</refentry>
86
+

87
+
<!-- Keep this comment at the end of the file
88
+
Local variables:
89
+
mode: sgml
90
+
sgml-omittag:t
91
+
sgml-shorttag:t
92
+
sgml-minimize-attributes:nil
93
+
sgml-always-quote-attributes:t
94
+
sgml-indent-step:1
95
+
sgml-indent-data:t
96
+
indent-tabs-mode:nil
97
+
sgml-parent-document:nil
98
+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
99
+
sgml-exposed-tags:nil
100
+
sgml-local-catalogs:nil
101
+
sgml-local-ecat-files:nil
102
+
End:
103
+
vim600: syn=xml fen fdm=syntax fdl=2 si
104
+
vim: et tw=78 syn=sgml
105
+
vi: ts=1 sw=1
106
+
-->
0
107