-
Notifications
You must be signed in to change notification settings - Fork 3
Application
The first thing you will want to do is establish the default configuration of your XQuerrail application. This is configured in the /_config/config.xml. XQuerrail by default is configured to act as an html/rest based application. There are various options you can specify to change the default values specified in the config.xml. Defaults allow any requests that do not specify a format extension such as .html or .xml will automatically be routed to the html engine for processing. In order to configure your first app you will only need to configure the <application/> definition.
###Configuring your application
- Locate the default entry in your
config.xmlcalled<application name="demo">... - Here is an example of the demo configuration. Most two most important configuration attributes of the application domain are the attributes
@name,@namespace, and the@uri. These values are used extensively by the routing, controller mapping and overall conventions of your application. Additional options can be specified that allow Tags ensure your resources and custom tags are mapped accordingly.
<application name="demo" namespace="http://xquerrail.com/demo" uri="/demo">
<domain resource="/demo/domains/application-domain.xml" />
<script-directory value="/demo/resources/js/"/>
<stylesheet-directory value="/demo/resources/css/"/>
<default-template value="main"/>
</application>###Configuration Options
| Option | Description |
|---|---|
| @name | defines your application name. This will be used to express any context information and how XQuerrail calls into your application. |
| @namespace | Establishes the default namespace that will be used across your application code. The namespace should be meaningful to your application |
| @uri | directory where the source code for your application will reside. XQuerrail will use this to establish calls to your application controllers/views and other features exposed from your application. |
| <domain @resource="..."> | Is the default entry domain used by your application. This must be present to use any dynamic scaffolding (see Domain Models). |
| <script-directory @resource="..."/> | Configures the location of your application specific javascript resources. |
| <stylesheet-directory resource="..."/> | Configures the location of your application specific css files. |
| <default-template value="..."/> | Configures the default template used to when a template is not specified by your controllers or the `` in the /config/default-template |
##Structuring your Application Directory
It is important to establish a proper directory structure in order for XQuerrail to route calls appropriately to your application. Remember XQuerrail uses conventions to call into your application, so following the default conventions will ensure proper routing. The following outlines the directory conventions used in xquerrail applicaton.
/src/
/_config/
/_framework/
/{application-name}/
+ /controllers/
+ /domains/
+ /models/
+ /resources/
+ /tags/
+ /templates/
+ /views/
/resources/
###XQuerrail Directory Definitions
The following are descriptions outlining the purpose each directory and the requirement by the XQuerrail framework.
| Directory | Required | Description |
|---|---|---|
| /{application-name}/ | This is your main application directory. The directory should map to the application/@uri element specified in config.xml | |
| /controllers/ | Required | Contains all controllers for your application. XQuerrail will look into this directory when routing calls to your application. |
| /domains/ | Optional | Contains all domain configuration. The `application-domain.xml` is required if using any dynamic scaffolding features in XQuerrail. |
| /resources/ | Optional | While note specifically required ,the resource directory should match your naming conventions for your public /resources/ directory. |
| /tags/ | Optional | Contains all the custom tags for your application. Tags provides a mechanism to create your own custom tab libraries used in your templates and views. |
| /templates/ | Optional | Contains all the templates specified for your applications. |
| /views/ | Optional | Is the directory where your application views will be maintained. The convention for creating views are based on the names of your controllers. So if you defined a controller named `foo ` then you will create a folder called `/{your-application}/views/foo/`. |