<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Application Configuration</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="yaf.tutorials.html">Examples</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.yaf-application.html">Yaf_Application</a></div> <div class="up"><a href="book.yaf.html">Yaf</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="yaf.appconfig" class="chapter"> <h1>Application Configuration</h1> <p class="para"> You should give an array of config or an ini config file(see <a href="class.yaf-config-ini.html" class="classname">Yaf_Config_Ini</a>) path to <span class="methodname"><a href="yaf-application.construct.html" class="methodname">Yaf_Application::__construct()</a></span>. </p> <p class="para"> Yaf configurations could be merged with user configurations. The difference is, Yaf configurations are prefixed with "yaf." or "application.", if there are both "yaf." and "application.", "application." will be used. <div class="example" id="example-4110"> <p><strong>Example #1 An array of yaf configuration example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /> $configs </span><span style="color: #007700">= array(<br /> </span><span style="color: #DD0000">"application" </span><span style="color: #007700">=> array(<br /> </span><span style="color: #DD0000">"directory" </span><span style="color: #007700">=> </span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">),<br /> </span><span style="color: #DD0000">"dispatcher" </span><span style="color: #007700">=> array(<br /> </span><span style="color: #DD0000">"catchException" </span><span style="color: #007700">=> </span><span style="color: #0000BB">0</span><span style="color: #007700">,<br /> ),<br /> </span><span style="color: #DD0000">"view" </span><span style="color: #007700">=> array(<br /> </span><span style="color: #DD0000">"ext" </span><span style="color: #007700">=> </span><span style="color: #DD0000">"phtml"</span><span style="color: #007700">,<br /> ),<br /> ),<br /> );<br /> </span><span style="color: #0000BB">$app </span><span style="color: #007700">= new </span><span style="color: #0000BB">Yaf_Application</span><span style="color: #007700">(</span><span style="color: #0000BB">$config</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> <div class="example" id="example-4111"> <p><strong>Example #2 an ini file of yaf configuration example</strong></p> <div class="example-contents"> <div class="inicode"><pre class="inicode">[yaf] yaf.directory = APPLICATION_PATH "/appliation" yaf.dispatcher.catchException = 0 [product : yaf] ; user configuration list here</pre> </div> </div> </div> </p> <p class="para"> <table class="doctable table"> <caption><strong>Yaf Application Config</strong></caption> <thead> <tr> <th>Name</th> <th>Default</th> <th>Changelog</th> </tr> </thead> <tbody class="tbody"> <tr> <td>application.directory</td> <td class="empty"> </td> <td></td> </tr> <tr> <td>application.ext</td> <td>"php"</td> <td></td> </tr> <tr> <td>application.view.ext</td> <td>"phtml"</td> <td></td> </tr> <tr> <td>application.modules</td> <td>"index"</td> <td></td> </tr> <tr> <td>application.library</td> <td>application.directory . "/library"</td> <td></td> </tr> <tr> <td>application.library.directory</td> <td>application.directory . "/library"</td> <td></td> </tr> <tr> <td>application.library.namespace</td> <td>""</td> <td></td> </tr> <tr> <td>application.bootstrap</td> <td>application.directory . "/Bootstrap" . application.ext</td> <td></td> </tr> <tr> <td>application.baseUri</td> <td>""</td> <td></td> </tr> <tr> <td>application.dispatcher.defaultRoute</td> <td class="empty"> </td> <td></td> </tr> <tr> <td>application.dispatcher.throwException</td> <td>1</td> <td></td> </tr> <tr> <td>application.dispatcher.catchException</td> <td>0</td> <td></td> </tr> <tr> <td>application.dispatcher.defaultModule</td> <td>"index"</td> <td></td> </tr> <tr> <td>application.dispatcher.defaultController</td> <td>"index"</td> <td></td> </tr> <tr> <td>application.dispatcher.defaultAction</td> <td>"index"</td> <td></td> </tr> <tr> <td>application.system</td> <td class="empty"> </td> <td></td> </tr> </tbody> </table> </p> <p class="para">Here's a short explanation of the configuration directives.</p> <p class="para"> <dl> <dt id="configuration.yaf.directory"> <span class="term"> <em><code class="parameter">application.directory</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> The directory of the application, that is the folder which contains the "controllers", "views", "models", "plugins" folders. </p> <p class="para"> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> This config entry is the only one which doesn't has a default value, which means you should always define it. </p> </p></blockquote> </p> </dd> </dt> <dt id="configuration.yaf.ext"> <span class="term"> <em><code class="parameter">application.ext</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> The file ext of the PHP script, used in class autoloading( <a href="class.yaf-loader.html" class="classname">Yaf_Loader</a>). </p> </dd> </dt> <dt id="configuration.yaf.view.ext"> <span class="term"> <em><code class="parameter">application.view.ext</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> The file ext of the view template script. </p> </dd> </dt> <dt id="configuration.yaf.modules"> <span class="term"> <em><code class="parameter">application.modules</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> A comma-separated list of the registered modules, used in the route process, especially while there are more than three segments in the PATH_INFO, </p> <p class="para"> Yaf need a way to find out whether the first segment is a module name or not. </p> </dd> </dt> <dt id="configuration.yaf.library"> <span class="term"> <em><code class="parameter">application.library</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> The local library directory, see <a href="class.yaf-loader.html" class="classname">Yaf_Loader</a> and <a href="yaf.configuration.html#ini.yaf.library" class="link">yaf.library</a>. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> As of Yaf 2.1.6, this config entry can also be a array, when it is array, then the library path will try to use the value of <a href="yaf.appconfig.html#configuration.yaf.library.directory" class="link">application.library.directory</a> </p> </p></blockquote> </dd> </dt> <dt id="configuration.yaf.library.directory"> <span class="term"> <em><code class="parameter">application.library.directory</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> Alias of <a href="yaf.appconfig.html#configuration.yaf.library" class="link">application.library</a>. Introduced in Yaf 2.1.6 </p> </dd> </dt> <dt id="configuration.yaf.library.namespace"> <span class="term"> <em><code class="parameter">application.library.namespace</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> A comma-separated prefix of local library namespace. </p> <p class="para"> Introduced in Yaf 2.1.6 </p> </dd> </dt> <dt id="configuration.yaf.bootstrap"> <span class="term"> <em><code class="parameter">application.bootstrap</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> A absolute path of the Bootstrap class script. </p> </dd> </dt> <dt id="configuration.yaf.baseuri"> <span class="term"> <em><code class="parameter">application.baseUri</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="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. </p> <p class="para"> In generally, you have no need to set this value. </p> </dd> </dt> <dt id="configuration.yaf.dispatcher.throwexception"> <span class="term"> <em><code class="parameter">application.dispatcher.throwException</code></em> <span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span> </span> <dd> <p class="para"> If this is On, Yaf will throw exception while some error occurring. see also <span class="methodname"><a href="yaf-dispatcher.throwexception.html" class="methodname">Yaf_Dispatcher::throwException()</a></span>. </p> </dd> </dt> <dt id="configuration.yaf.dispatcher.catchexception"> <span class="term"> <em><code class="parameter">application.dispatcher.catchException</code></em> <span class="type"><a href="language.types.boolean.html" class="type bool">bool</a></span> </span> <dd> <p class="para"> If this is On, Yaf will forward to Error controller, Error Action while there is a uncaught exception. see also <span class="methodname"><a href="yaf-dispatcher.catchexception.html" class="methodname">Yaf_Dispatcher::catchException()</a></span>. </p> </dd> </dt> <dt id="configuration.yaf.dispatcher.defaulRoute"> <span class="term"> <em><code class="parameter">application.dispatcher.defaultRoute</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> The default Route, if it is not specificed, Static route will be used as default route, see: <span class="methodname"><a href="yaf-router.addroute.html" class="methodname">Yaf_Router::addRoute()</a></span>. </p> </dd> </dt> <dt id="configuration.yaf.dispatcher.defaultmodule"> <span class="term"> <em><code class="parameter">application.dispatcher.defaultModule</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> The default module name, see also <span class="methodname"><a href="yaf-dispatcher.setdefaultmodule.html" class="methodname">Yaf_Dispatcher::setDefaultModule()</a></span>. </p> </dd> </dt> <dt id="configuration.yaf.dispatcher.defaultcontroller"> <span class="term"> <em><code class="parameter">application.dispatcher.defaultController</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> The default controller name, see also <span class="methodname"><a href="yaf-dispatcher.setdefaultcontroller.html" class="methodname">Yaf_Dispatcher::setDefaultController()</a></span>. </p> </dd> </dt> <dt id="configuration.yaf.dispatcher.defaultaction"> <span class="term"> <em><code class="parameter">application.dispatcher.defaultAction</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> The default action name, see also <span class="methodname"><a href="yaf-dispatcher.setdefaultaction.html" class="methodname">Yaf_Dispatcher::setDefaultAction()</a></span>. </p> </dd> </dt> <dt id="configuration.yaf.system"> <span class="term"> <em><code class="parameter">application.system</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> Set yaf runtime configure in application.ini, like: <a href="yaf.configuration.html#ini.yaf.lowcase-path" class="link">application.system.lowcase_path</a> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> only those PHP_INI_ALL configures can be set in this way </p> </p></blockquote> </p> </dd> </dt> </dl> </p> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="yaf.tutorials.html">Examples</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.yaf-application.html">Yaf_Application</a></div> <div class="up"><a href="book.yaf.html">Yaf</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>