2011-12-02 03:53:40 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2011-12-06 17:07:04 +00:00
|
|
|
<!-- $Revision$ -->
|
2011-12-02 03:53:40 +00:00
|
|
|
|
|
|
|
<chapter xml:id="yaf.appconfig" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
<title xmlns="http://docbook.org/ns/docbook">Application Configuration</title>
|
|
|
|
<para>
|
|
|
|
You should give an array of config or an ini config file(see
|
2011-12-02 03:54:50 +00:00
|
|
|
<classname>Yaf_Config_Ini</classname>) path to
|
2011-12-02 03:53:40 +00:00
|
|
|
<methodname>Yaf_Application::__construct</methodname>.
|
|
|
|
</para>
|
|
|
|
<para>
|
2014-07-20 07:00:05 +00:00
|
|
|
Yaf will merge the application configurations and user configurations
|
|
|
|
automatically. The application configurations have prefix "yaf." or
|
|
|
|
"application.". If both "yaf." and "application." exist, "application."
|
2016-09-28 12:54:16 +00:00
|
|
|
will be accepted preferentially.
|
2011-12-02 03:53:40 +00:00
|
|
|
<example>
|
2014-07-20 07:00:05 +00:00
|
|
|
<title>An PHP array example</title>
|
2011-12-02 03:53:40 +00:00
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$configs = array(
|
|
|
|
"application" => array(
|
|
|
|
"directory" => dirname(__FILE__),
|
|
|
|
"dispatcher" => array(
|
|
|
|
"catchException" => 0,
|
|
|
|
),
|
|
|
|
"view" => array(
|
|
|
|
"ext" => "phtml",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
2016-01-15 18:11:43 +00:00
|
|
|
$app = new Yaf_Application($configs);
|
2012-01-10 02:37:08 +00:00
|
|
|
?>
|
2011-12-02 03:53:40 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
<example>
|
2014-07-20 07:00:05 +00:00
|
|
|
<title>An ini file example</title>
|
2011-12-02 03:53:40 +00:00
|
|
|
<programlisting role="ini">
|
|
|
|
<![CDATA[
|
|
|
|
[yaf]
|
|
|
|
yaf.directory = APPLICATION_PATH "/appliation"
|
|
|
|
yaf.dispatcher.catchException = 0
|
|
|
|
|
|
|
|
[product : yaf]
|
2012-08-07 14:45:39 +00:00
|
|
|
; user configuration list here
|
2011-12-02 03:53:40 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<table>
|
|
|
|
<title>Yaf Application Config</title>
|
|
|
|
<tgroup cols="3">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Name;</entry>
|
|
|
|
<entry>&Default;</entry>
|
|
|
|
<entry>&Changelog;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry>application.directory</entry>
|
|
|
|
<entry></entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.ext</entry>
|
|
|
|
<entry>"php"</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.view.ext</entry>
|
|
|
|
<entry>"phtml"</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.modules</entry>
|
|
|
|
<entry>"index"</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.library</entry>
|
|
|
|
<entry>application.directory . "/library"</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
2011-12-29 11:03:12 +00:00
|
|
|
<row>
|
|
|
|
<entry>application.library.directory</entry>
|
|
|
|
<entry>application.directory . "/library"</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.library.namespace</entry>
|
|
|
|
<entry>""</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
2011-12-02 03:53:40 +00:00
|
|
|
<row>
|
|
|
|
<entry>application.bootstrap</entry>
|
|
|
|
<entry>application.directory . "/Bootstrap" . application.ext</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.baseUri</entry>
|
|
|
|
<entry>""</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
2012-04-21 02:43:08 +00:00
|
|
|
<row>
|
|
|
|
<entry>application.dispatcher.defaultRoute</entry>
|
|
|
|
<entry></entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
2011-12-02 03:53:40 +00:00
|
|
|
<row>
|
|
|
|
<entry>application.dispatcher.throwException</entry>
|
|
|
|
<entry>1</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.dispatcher.catchException</entry>
|
|
|
|
<entry>0</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.dispatcher.defaultModule</entry>
|
|
|
|
<entry>"index"</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.dispatcher.defaultController</entry>
|
|
|
|
<entry>"index"</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>application.dispatcher.defaultAction</entry>
|
|
|
|
<entry>"index"</entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
2012-09-07 16:40:32 +00:00
|
|
|
<row>
|
|
|
|
<entry>application.system</entry>
|
|
|
|
<entry></entry>
|
|
|
|
<entry><!-- leave empty, this will be filled by an automatic script --></entry>
|
|
|
|
</row>
|
2011-12-02 03:53:40 +00:00
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</table>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
&ini.descriptions.title;
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry xml:id="configuration.yaf.directory">
|
|
|
|
<term>
|
|
|
|
<parameter>application.directory</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The directory of the application, that is the folder which contains the
|
|
|
|
"controllers", "views", "models", "plugins" folders.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<note>
|
|
|
|
<para>
|
2014-07-20 07:00:05 +00:00
|
|
|
This config entry is the only one which doesn't has a default value.
|
|
|
|
You should always define it manually.
|
2011-12-02 03:53:40 +00:00
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.ext">
|
|
|
|
<term>
|
|
|
|
<parameter>application.ext</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The file ext of the PHP script, used in class autoloading(
|
|
|
|
<classname>Yaf_Loader</classname>).
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.view.ext">
|
|
|
|
<term>
|
|
|
|
<parameter>application.view.ext</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2014-07-20 07:00:05 +00:00
|
|
|
The file ext of the view template scripts.
|
2011-12-02 03:53:40 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.modules">
|
|
|
|
<term>
|
|
|
|
<parameter>application.modules</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-08-07 15:08:22 +00:00
|
|
|
A comma-separated list of the registered modules, used in the route
|
2011-12-02 03:53:40 +00:00
|
|
|
process, especially while there are more than three segments in the PATH_INFO,
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Yaf need a way to find out whether the first segment is a module name or not.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.library">
|
|
|
|
<term>
|
|
|
|
<parameter>application.library</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The local library directory, see <classname>Yaf_Loader</classname> and
|
|
|
|
<link linkend="ini.yaf.library">yaf.library</link>.
|
|
|
|
</para>
|
2011-12-29 11:03:12 +00:00
|
|
|
<note>
|
|
|
|
<para>
|
2014-07-20 07:00:05 +00:00
|
|
|
After Yaf 2.1.6, this config entry can be an array. The library path
|
|
|
|
will try to use the items setted in <link
|
|
|
|
linkend="configuration.yaf.library.directory">application.library.directory</link>
|
2011-12-29 11:03:12 +00:00
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.library.directory">
|
|
|
|
<term>
|
|
|
|
<parameter>application.library.directory</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2013-02-28 05:53:22 +00:00
|
|
|
Alias of <link
|
|
|
|
linkend="configuration.yaf.library">application.library</link>. Introduced
|
|
|
|
in Yaf 2.1.6
|
2011-12-29 11:03:12 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.library.namespace">
|
|
|
|
<term>
|
|
|
|
<parameter>application.library.namespace</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-08-07 14:45:39 +00:00
|
|
|
A comma-separated prefix of local library namespace.
|
2011-12-29 11:03:12 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Introduced in Yaf 2.1.6
|
|
|
|
</para>
|
2011-12-02 03:53:40 +00:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.bootstrap">
|
|
|
|
<term>
|
|
|
|
<parameter>application.bootstrap</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
A absolute path of the Bootstrap class script.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2012-01-12 15:20:59 +00:00
|
|
|
<varlistentry xml:id="configuration.yaf.baseuri">
|
2011-12-02 03:53:40 +00:00
|
|
|
<term>
|
|
|
|
<parameter>application.baseUri</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Used to remove a fixed prefix of request uri in route process.
|
|
|
|
Take a example, comes a request with request uri
|
|
|
|
"/prefix/controller/action". if you set application.baseUri to
|
|
|
|
"/prefix", then only "/controller/action" will take as the PATH_INFO in
|
|
|
|
route process.
|
|
|
|
</para>
|
|
|
|
<para>
|
2014-07-20 07:00:05 +00:00
|
|
|
In generally, there is no need to set this value.
|
2011-12-02 03:53:40 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.dispatcher.throwexception">
|
|
|
|
<term>
|
|
|
|
<parameter>application.dispatcher.throwException</parameter>
|
|
|
|
<type>bool</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2014-07-20 07:00:05 +00:00
|
|
|
If it set to On, Yaf will throw an exception while some error occurring.
|
|
|
|
See also <methodname>Yaf_Dispatcher::throwException</methodname>.
|
2011-12-02 03:53:40 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.dispatcher.catchexception">
|
|
|
|
<term>
|
|
|
|
<parameter>application.dispatcher.catchException</parameter>
|
|
|
|
<type>bool</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2014-07-20 07:00:05 +00:00
|
|
|
If it set to On, Yaf will forward to Error controller/Action while
|
|
|
|
there is an unhandled exception. See also
|
2011-12-02 03:53:40 +00:00
|
|
|
<methodname>Yaf_Dispatcher::catchException</methodname>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2012-04-21 02:43:08 +00:00
|
|
|
<varlistentry xml:id="configuration.yaf.dispatcher.defaulRoute">
|
|
|
|
<term>
|
|
|
|
<parameter>application.dispatcher.defaultRoute</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The default Route, if it is not specificed, Static route will be used
|
2014-07-20 07:00:05 +00:00
|
|
|
as default. See:
|
2012-04-21 02:43:08 +00:00
|
|
|
<methodname>Yaf_Router::addRoute</methodname>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2011-12-02 03:53:40 +00:00
|
|
|
<varlistentry xml:id="configuration.yaf.dispatcher.defaultmodule">
|
|
|
|
<term>
|
|
|
|
<parameter>application.dispatcher.defaultModule</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The default module name, see also
|
|
|
|
<methodname>Yaf_Dispatcher::setDefaultModule</methodname>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.dispatcher.defaultcontroller">
|
|
|
|
<term>
|
|
|
|
<parameter>application.dispatcher.defaultController</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The default controller name, see also
|
|
|
|
<methodname>Yaf_Dispatcher::setDefaultController</methodname>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="configuration.yaf.dispatcher.defaultaction">
|
|
|
|
<term>
|
|
|
|
<parameter>application.dispatcher.defaultAction</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The default action name, see also
|
|
|
|
<methodname>Yaf_Dispatcher::setDefaultAction</methodname>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2012-09-07 16:40:32 +00:00
|
|
|
<varlistentry xml:id="configuration.yaf.system">
|
|
|
|
<term>
|
|
|
|
<parameter>application.system</parameter>
|
|
|
|
<type>string</type>
|
|
|
|
</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Set yaf runtime configure in application.ini, like:
|
|
|
|
<link linkend="ini.yaf.lowcase-path">application.system.lowcase_path</link>
|
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
only those PHP_INI_ALL configures can be set in this way
|
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2011-12-02 03:53:40 +00:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</chapter>
|
|
|
|
|
|
|
|
<!-- 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
|
|
|
|
-->
|