Page Configurations

Page configurations are mainly used by TPageService to modify or append the application configuration. As the name indicates, a page configuration is associated with a directory storing some page files. It is stored as an XML file named config.xml.

When a user requests a page stored under <BasePath>/dir1/dir2, the TPageService will try to parse and load config.xml files under <BasePath>, <BasePath>/dir1 and <BasePath>/dir1/dir2. Paths, modules, and parameters specified in these configuration files will be appended or merged into the existing application configuration. Here <BasePath> is as defined in page service.

The format of a page configuration file is as follows,

<configuration>
  <paths>
    <alias id="AliasID" path="AliasPath" />
    <using namespace="Namespace" />
  </paths>
  <modules>
    <module id="ModuleID" class="ModuleClass"  PropertyName="PropertyValue" ... />
  </modules>
  <parameters>
    <parameter id="ParameterID" class="ParameterClass" PropertyName="PropertyValue" ... />
  </parameters>
  <include file="path.to.extconfig" when="PHP expression" />
  <authorization>
    <allow pages="PageID1,PageID2" users="User1,User2" roles="Role1,Role2" verb="get" />
    <deny pages="PageID1,PageID2" users="User1,User2" roles="Role1,Role2" verb="post" />
  </authorization>
  <pages PropertyName="PropertyValue" ...>
    <page id="PageID" PropertyName="PropertyValue" ... />
  </pages>
</configuration>

The <paths>, <modules>, <parameters> and <include> are similar to those in an application configuration. The <authorization> element specifies the authorization rules that apply to the current page directory and all its subdirectories. For more details, see authentication and authorization section. The <pages> element specifies the initial values for the properties of pages. Each <page> element specifies the initial property values for a particular page identified by the id attribute. Initial property values given in the <pages> element apply to all pages in the current directory and all its subdirectories.

Complete specification of page configurations can be found in the DTD and XSD files.

Available from Prado versions 3.1.1 onwards.

Since version 3.1.1, the id attribute in the <page> element can be a relative page path pointing to a page in the subdirectory of the directory containing the page configuration. For example, id="admin.Home" refers to the Home page under the admin directory. The id attribute can also contain wildcard '*' to match all pages under the specified directory. For example, id="admin.*" refers to all pages under the admin directory and its subdirectories. This enhancement allows developers to centralize their page configurations (e.g. put all page initializations in the aplication configuration or the root page configuration.)