Application configurations are used to specify the global behavior of an application. This consists of specifying the paths, modules, services and parameters that will be used in an application.
Application configurations are stored in an XML file which is passed as a parameter to the TApplication
instance. The format of application configurations is shown in the following,
<application PropertyName="PropertyValue" ...> <paths> <alias id="AliasID" path="AliasPath" /> <using namespace="Namespace" /> </paths> <modules> <module id="ModuleID" class="ModuleClass" PropertyName="PropertyValue" ... /> </modules> <services> <service id="ServiceID" class="ServiceClass" PropertyName="PropertyValue" ... /> </services> <parameters> <parameter id="ParameterID" class="ParameterClass" PropertyName="PropertyValue" ... /> </parameters> </application>
<application>
corresponds to the TApplication
instance. The PropertyName="PropertyValue"
pairs specify the initial values for the properties of TApplication
.<paths>
element contains the definition of path aliases and the PHP inclusion paths for the application. Each path alias is specified via an <alias>
whose path
attribute takes an absolute path or a path relative to the directory containing the application configuration file. The <using>
element specifies a particular path (in terms of namespace) to be appended to the PHP include paths when the application runs. PRADO defines two default aliases: System
and Application
. The former refers to the PRADO framework root directory, and the latter refers to the directory containing the application configuration file.<modules>
element contains the configurations for a list of modules. Each module is specified by a <module>
element. Each module is uniquely identified by the id
attribute and is of type class
. The PropertyName="PropertyValue"
pairs specify the initial values for the properties of the module.<services>
element is similar to the <modules>
element. It mainly specifies the services provided by the application.<parameters>
element contains a list of application-level parameters that are accessible from anywhere in the application. You may specify component-typed parameters like specifying modules, or you may specify string-typed parameters which take a simpler format as follows,
<parameter id="ParameterID">ParameterValue</parameter>
THttpRequest
, THttpResponse
, etc. It will also provide the TPageService
as a default service. Configuration and usage of these modules and services are covered in individual sections of this tutorial. Note, if your application takes default settings for these modules and service, you do not need to provide an application configuration. However, if these modules or services are not sufficient, or you want to change their behavior by configuring their property values, you will need an application configuration.