[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-cvs
Subject: [DOC-CVS] =?utf-8?q?svn:_/phpdoc/en/trunk/reference/yaf/_ini.xml_yaf-loader.xml_yaf-router.xml_yaf=5
From: Xinchen_Hui <laruence () php ! net>
Date: 2011-11-26 15:53:03
Message-ID: svn-laruence-1322322783-319958-278900034 () svn ! php ! net
[Download RAW message or body]
laruence Sat, 26 Nov 2011 15:53:03 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=319958
Log:
update docs
Changed paths:
U phpdoc/en/trunk/reference/yaf/ini.xml
U phpdoc/en/trunk/reference/yaf/yaf-loader.xml
U phpdoc/en/trunk/reference/yaf/yaf-router.xml
U phpdoc/en/trunk/reference/yaf/yaf_application/construct.xml
["svn-diffs-319958.txt" (text/x-diff)]
Modified: phpdoc/en/trunk/reference/yaf/ini.xml
===================================================================
--- phpdoc/en/trunk/reference/yaf/ini.xml 2011-11-26 15:43:05 UTC (rev 319957)
+++ phpdoc/en/trunk/reference/yaf/ini.xml 2011-11-26 15:53:03 UTC (rev 319958)
@@ -227,12 +227,12 @@
</term>
<listitem>
<para>
- This value is "dev" by default, used for Yaf to fetch the config
+ This value is "product" by default, used for Yaf to fetch the config
section of a ini config file.
</para>
<para>
- That is, if this value is "dev", Yaf will use the section named "dev"
- in the ini config file(the first parameter of the
+ That is, if this value is "product", Yaf will use the section named
+ "product" in the ini config file(the first parameter of the
<classname>Yaf_Application</classname>) as the final config of the
<classname>Yaf_Application</classname>.
</para>
Modified: phpdoc/en/trunk/reference/yaf/yaf-loader.xml
===================================================================
--- phpdoc/en/trunk/reference/yaf/yaf-loader.xml 2011-11-26 15:43:05 UTC (rev 319957)
+++ phpdoc/en/trunk/reference/yaf/yaf-loader.xml 2011-11-26 15:53:03 UTC (rev 319958)
@@ -36,26 +36,38 @@
</para>
<para>
- <programlisting role="shell">
+ <example>
+ <title>Config example</title>
+ <programlisting role="shell">
<![CDATA[
// Assuming the following configure in php.ini:
yaf.libraray = "/global_dir"
//Assuming the following configure in application.ini
application.libraray = APPLICATION_PATH "/library"
+]]>
+ </programlisting>
+ </example>
-//Assuming the following local name space registerd:
+ Assuming the following local name space registerd:
+ <example>
+ <title>Register localnamespace</title>
+ <programlisting role="php">
+<![CDATA[
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract{
- public function _initLoader($dispatcher) {
- Yaf_Loader::getInstance()->registerLocalNameSpace(array("Foo", "Bar"));
- }
+ public function _initLoader($dispatcher) {
+ Yaf_Loader::getInstance()->registerLocalNameSpace(array("Foo", "Bar"));
+ }
?>
]]>
- </programlisting>
+ </programlisting>
+ </example>
- then the autoload examples:
- <programlisting role="shell">
+ Then the autoload examples:
+ <example>
+ <title>Load class example</title>
+ <programlisting role="shell">
<![CDATA[
class Foo_Bar_Test =>
// APPLICATION_PATH/library/Foo/Bar/Test.php
@@ -66,11 +78,13 @@
class BarNon_Test
// /global_dir/Barnon/Test.php
]]>
- </programlisting>
+ </programlisting>
+ </example>
- As of PHP 5.3, you can use namespace, in this case you need open the
- <link linkend="ini.yaf.use-namespace">yaf.use_namespace</link> on, then:
- <programlisting role="shell">
+ As of PHP 5.3, you can use namespace:
+ <example>
+ <title>Load namespace class example</title>
+ <programlisting role="shell">
<![CDATA[
class \Foo\Bar\Dummy =>
// APPLICATION_PATH/library/Foo/Bar/Dummy.php
@@ -78,8 +92,10 @@
class \FooBar\Bar\Dummy =>
// /global_dir/FooBar/Bar/Dummy.php
]]>
- </programlisting>
+ </programlisting>
+ </example>
</para>
+
<para>
You may noticed that all the folder wth the first letter capitalized, you can make them
lowercase by set <link linkend="ini.yaf.lowcase-path">yaf.lowcase_path</link> = On in php.ini
@@ -88,23 +104,28 @@
<para>
<classname>Yaf_Loader</classname> is also designed to load the MVC classes,
and the rule is:
- <programlisting role="shell">
+ <example>
+ <title>MVC class loading example</title>
+ <programlisting role="shell">
<![CDATA[
Controller Classes =>
- // APPLICATION_PATH/controllers/
+// APPLICATION_PATH/controllers/
Model Classes =>
- // APPLICATION_PATH/models/
+// APPLICATION_PATH/models/
Plugin Classes =>
- // APPLICATION_PATH/plugins/
+// APPLICATION_PATH/plugins/
]]>
- </programlisting>
+ </programlisting>
+ </example>
Yaf identify a class's suffix(this is by default, you can also change to
the prefix by change the configure <link
linkend="ini.yaf.name-suffix">yaf.name_suffix</link>) to decide whether it
is a MVC class:
+ <example>
+ <title>MVC class distinctions</title>
<programlisting role="shell">
<![CDATA[
Controller Classes =>
@@ -117,9 +138,12 @@
// ***Plugin
]]>
</programlisting>
+ </example>
some examples:
- <programlisting role="shell">
+ <example>
+ <title>MVC loading example</title>
+ <programlisting role="shell">
<![CDATA[
class IndexController
// APPLICATION_PATH/controllers/Index.php
@@ -133,7 +157,8 @@
class A_B_TestModel =>
// APPLICATION_PATH/models/A/B/Test.php
]]>
- </programlisting>
+ </programlisting>
+ </example>
also, the directory will be affected by <link linkend="ini.yaf.lowcase-path">yaf.lowcase_path</link>.
</para>
Modified: phpdoc/en/trunk/reference/yaf/yaf-router.xml
===================================================================
--- phpdoc/en/trunk/reference/yaf/yaf-router.xml 2011-11-26 15:43:05 UTC (rev 319957)
+++ phpdoc/en/trunk/reference/yaf/yaf-router.xml 2011-11-26 15:53:03 UTC (rev 319958)
@@ -27,13 +27,18 @@
on Rails routing and does not require any prior knowledge of webserver URL
rewriting. It is designed to work with a single Apache mod_rewrite rule
(one of):
+ <example>
+ <title>Rewrite rule for Apache</title>
<programlisting role="conf">
<![CDATA[
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|html)$ index.php
]]>
</programlisting>
+ </example>
or (preferred):
+ <example>
+ <title>Rewrite rule for Apache</title>
<programlisting role="conf">
<![CDATA[
RewriteEngine On
@@ -44,7 +49,10 @@
RewriteRule ^.*$ index.php [NC,L]
]]>
</programlisting>
+ </example>
If using Lighttpd, the following rewrite rule is valid:
+ <example>
+ <title>Rewrite rule for Lighttpd</title>
<programlisting role="conf">
<![CDATA[
url.rewrite-once = (
@@ -54,6 +62,25 @@
)
]]>
</programlisting>
+ </example>
+ If using Nginx, use the following rewrite rule:
+ <example>
+ <title>Rewrite rule for Nginx</title>
+ <programlisting role="conf">
+<![CDATA[
+server {
+ listen ****;
+ server_name yourdomain.com;
+ root document_root;
+ index index.php index.html;
+
+ if (!-e $request_filename) {
+ rewrite ^/(.*) /index.php/$1 last;
+ }
+}
+]]>
+ </programlisting>
+ </example>
</para>
</section>
<!-- }}} -->
@@ -67,15 +94,20 @@
module/controller/action. Finally, it will also match any additional
parameters appended to the URI by default -
controller/action/var1/value1/var2/value2.
- <note>
- <para>
- Module name must be defined like application.module="Index,Foo,Bar"
- in this case, only index, foo and bar can be considerd as a module name,
- defaultly, there is only one module name "Index" was preconfigured.
- </para>
- </note>
+ <note>
+ <para>
+ Module name must be defined in config, considering application.module="Index,Foo,Bar",
+ in this case, only index, foo and bar can be considerd as a module name.
+ if doesn't config, there is only one module named "Index".
+ </para>
+ </note>
+ </para>
+ <para>
Some examples of how such routes are matched:
+ <example>
+ <title><classname>Yaf_Route_Static</classname>(default
+ route)example</title>
<programlisting role="conf">
<![CDATA[
// Assuming the following configure:
@@ -115,6 +147,7 @@
date == desc
]]>
</programlisting>
+ </example>
</para>
</section>
Modified: phpdoc/en/trunk/reference/yaf/yaf_application/construct.xml
===================================================================
--- phpdoc/en/trunk/reference/yaf/yaf_application/construct.xml 2011-11-26 15:43:05 UTC (rev 319957)
+++ phpdoc/en/trunk/reference/yaf/yaf_application/construct.xml 2011-11-26 15:53:03 UTC (rev 319958)
@@ -31,13 +31,51 @@
<para>
A ini config file path, or a config array
</para>
+ <para>
+ If is a ini config file, there should be a section named as the one
+ defined by <link linkend="ini.yaf.environ">yaf.environ</link>, which
+ is "product" by default.
+ </para>
+ <para>
+ And the config entry(and there default value) list blow:
+ <example>
+ <title>A ini config file example</title>
+ <programlisting role="ini" xml:id="yaf.application.ini">
+<![CDATA[
+[product]
+;this one should alway be defined, and have no default value
+application.directory=APPLICATION_PATH
+
+;following configs have default value, you may no need to define them
+application.library = APPLICATION_PATH . "/library"
+application.dispatcher.throwException=1
+application.dispatcher.catchException=1
+
+application.baseUri=""
+
+;the php script ext name
+ap.ext=php
+
+;the view template ext name
+ap.view.ext=phtml
+
+ap.dispatcher.defaultModuel=Index
+ap.dispatcher.defaultController=Index
+ap.dispatcher.defaultAction=index
+
+;defined modules
+ap.modules=Index
+]]>
+ </programlisting>
+ </example>
+ </para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>envrion</parameter></term>
<listitem>
<para>
-
+ Which section will be loaded as the final config
</para>
</listitem>
</varlistentry>
--
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic