diff --git a/reference/yaf/appconfig.xml b/reference/yaf/appconfig.xml new file mode 100644 index 0000000000..09bd3e4947 --- /dev/null +++ b/reference/yaf/appconfig.xml @@ -0,0 +1,315 @@ + + + + + Application Configuration + + You should give an array of config or an ini config file(see + Yaf_Config_Ini path to + Yaf_Application::__construct. + + + 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 accepcted + preferentially. + + An array of yaf configuration example + + array( + "directory" => dirname(__FILE__), + "dispatcher" => array( + "catchException" => 0, + ), + "view" => array( + "ext" => "phtml", + ), + ), + ); + $app = new Yaf_Application($config); +]]> + + + + an ini file of yaf configuration example + + + + + + + + Yaf Application Config + + + + &Name; + &Default; + &Changelog; + + + + + application.directory + + + + + application.ext + "php" + + + + application.view.ext + "phtml" + + + + application.modules + "index" + + + + application.library + application.directory . "/library" + + + + application.bootstrap + application.directory . "/Bootstrap" . application.ext + + + + application.baseUri + "" + + + + application.dispatcher.throwException + 1 + + + + application.dispatcher.catchException + 0 + + + + application.dispatcher.defaultModule + "index" + + + + application.dispatcher.defaultController + "index" + + + + application.dispatcher.defaultAction + "index" + + + + +
+
+ + &ini.descriptions.title; + + + + + + application.directory + string + + + + The directory of the application, that is the folder which contains the + "controllers", "views", "models", "plugins" folders. + + + + + This config entry is the only one which doesn't has a default value, which means you should + always define it. + + + + + + + + application.ext + string + + + + The file ext of the PHP script, used in class autoloading( + Yaf_Loader). + + + + + + application.view.ext + string + + + + The file ext of the view template script. + + + + + + application.modules + string + + + + A commaseparated list of the registered modules, used in the route + process, especially while there are more than three segments in the PATH_INFO, + + + Yaf need a way to find out whether the first segment is a module name or not. + + + + + + application.library + string + + + + The local library directory, see Yaf_Loader and + yaf.library. + + + + + + application.bootstrap + string + + + + A absolute path of the Bootstrap class script. + + + + + + application.baseUri + string + + + + 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. + + + In generally, you have no need to set this value. + + + + + + application.dispatcher.throwException + bool + + + + If this is On, Yaf will throw exception while some error occurring. see + also Yaf_Dispatcher::throwException. + + + + + + application.dispatcher.catchException + bool + + + + If this is On, Yaf will forward to Error controller, Error Action while + there is a uncaught exception. see also + Yaf_Dispatcher::catchException. + + + + + + application.dispatcher.defaultModule + string + + + + The default module name, see also + Yaf_Dispatcher::setDefaultModule. + + + + + + application.dispatcher.defaultController + string + + + + The default controller name, see also + Yaf_Dispatcher::setDefaultController. + + + + + + application.dispatcher.defaultAction + string + + + + The default action name, see also + Yaf_Dispatcher::setDefaultAction. + + + + + + +
+ + diff --git a/reference/yaf/book.xml b/reference/yaf/book.xml index 1dc59435f3..c215a39313 100644 --- a/reference/yaf/book.xml +++ b/reference/yaf/book.xml @@ -16,11 +16,16 @@ Yaf require PHP version greater than 5.2.1, and could not run with early version of PHP. + + A simple Yaf performance benchmarks can be found at Yaf Performance. + &reference.yaf.setup; &reference.yaf.constants; &reference.yaf.examples; + &reference.yaf.appconfig; &reference.yaf.yaf-application; &reference.yaf.yaf-bootstrap-abstract; &reference.yaf.yaf-dispatcher; diff --git a/reference/yaf/yaf-loader.xml b/reference/yaf/yaf-loader.xml index 287a8ef467..6be6a11b55 100644 --- a/reference/yaf/yaf-loader.xml +++ b/reference/yaf/yaf-loader.xml @@ -46,11 +46,15 @@ If you want Yaf_Loader search some classes(libraries) in the local class directory(which is defined in application.ini, and by default, - it is APPLICATION_PATH . "/libraray"), you should register the class prefix using the + it is application.directory . "/libraray"), + you should register the class prefix using the Yaf_Loader::registerLocalNameSpace + Let's see some examples(assuming APPLICATION_PATH is application.directory): Config example @@ -235,8 +239,9 @@ class A_B_TestModel => _library - By default, this value is APPLICATION_PATH . "/library", you can change - this either in the application.ini(application.library) or call to + By default, this value is application.directory . "/library", + you can change this either in the application.ini(application.library) or call to Yaf_Loader::setLibraryPath diff --git a/reference/yaf/yaf_dispatcher/registerplugin.xml b/reference/yaf/yaf_dispatcher/registerplugin.xml index 968d27d823..db128c3e1d 100644 --- a/reference/yaf/yaf_dispatcher/registerplugin.xml +++ b/reference/yaf/yaf_dispatcher/registerplugin.xml @@ -54,9 +54,9 @@ class Bootstrap extends Yaf_Bootstrap_Abstract{ public function _initPlugin(Yaf_Dispatcher $dispatcher) { /** - * Yaf assumes plugin scripts under APPLICATION_PATH . "/plugins" + * Yaf assumes plugin scripts under [application.directory] . "/plugins" * for this case, it will be: - * APPLICATION_PATH . "/plugins/" . "User.php" + * [application.directory] . "/plugins/" . "User" . [application.ext] */ $user = new UserPlugin(); $dispatcher->registerPlugin($user); diff --git a/reference/yaf/yaf_router/getcurrentroute.xml b/reference/yaf/yaf_router/getcurrentroute.xml index 7dd4f4a7d6..6e8f3b0b9c 100644 --- a/reference/yaf/yaf_router/getcurrentroute.xml +++ b/reference/yaf/yaf_router/getcurrentroute.xml @@ -84,7 +84,8 @@ class Bootstrap extends Yaf_Bootstrap_Abstract{ - plugin Dummy.php (under APPLICATION_PATH/plugins) + plugin Dummy.php (under <link + linkend="configuration.yaf.directory">application.directory</link>/plugins) A absolute path to the template directory, by default, Yaf_Dispatcher use - APPLICATION_PATH . "/views" as this paramter. + application.directory . "/views" as this paramter.