The framework and application configuration file
- mvc,
- baseUrl,
- addBaseUrl,
- useUrl,
- langFolder,
- fwkFolder,
- pluginFolder,
- langFolder,
- debugWay,
- debug,
- debugFwk,
- debugBinding,
- debugLaunchMethod,
- showTiming,
- debugUrl,
- useLang,
- langFileExtension,
- langParseMethod,
- defaultLang,
- lang,
- useDynCompression,
- dynCompressionUrl,
- usePacker,
- useCache,
- compressedName,
- viewFileExt,
- getSuffix,
- setSuffix
What's in it ?
In this XML file, you will find everything concerning the configuration of the framework. You could also put configuration of your application in it. But act carefully when editing the XML file : do not break it !
Let's take a look
Here is an example of a conf.xml file :
<?xml version="1.0" encoding="utf-8"?> <items> <framework> <item version="1.0.7" /> <url> <item mvc="http://localhost/js/application/mvc.xml" /> <item baseUrl="http://localhost/js/" /> <item addBaseUrl="true" /> <item useUrl="false" /> </url> <folder> <item langFolder="lang/" /> <item fwkFolder="WZFwk_multiton/" /> <item pluginFolder="WZPlugin/" /> <item langFolder="lang/" /> </folder> <debug> <item debugWay="console" /> <item debug="false" /> <item debugFwk="false" /> <item debugBinding="false" /> <item debugLaunchMethod="false" /> <item showTiming="false" /> <item debugUrl="false" /> </debug> <lang> <item useLang="false" /> <item langFileExtension="conf" /> <item langParseMethod="flat" /> <item defaultLang="fr_FR" /> </lang> <compression> <item useDynCompression="true" /> <item dynCompressionUrl="WZFwk_multiton/php/dyn/dyn.php" /> <item usePacker="true" /> <item useCache="true" /> <item compressedName="compress" /> </compression> <view> <item viewFileExt="html" /> </view> <getset> <item getSuffix="get_" /> <item setSuffix="set_" /> </getset> </framework> <application> <item myApplicationName="myFirstProject" /> <item myApplicationNumber="42" /> </application> </items>
As you can see, this file is divided in two main parts :
- framework,
- application.
The first part is reserved for the framework configuration and these values can be changed so the framework do what you want. The second part belongs to you and you can put in it wathever item you could need while developping your application.
The framework parser only parse items that are in items > framework > item and items > application > item. That means two things. First, some tags in the conf file below are not used at all and are just here to clarify it. Second, you can add your own tag in your application data to put them in order. That means that the configuration file below will be interpreted exactly as the first one we saw.
<?xml version="1.0" encoding="utf-8"?> <items> <framework> <item version="1.0.7" /> <item mvc="http://localhost/js/application/mvc.xml" /> <item baseUrl="http://localhost/js/" /> <item addBaseUrl="true" /> <item useUrl="false" /> <item langFolder="lang/" /> <item fwkFolder="WZFwk_multiton/" /> <item pluginFolder="WZPlugin/" /> <item langFolder="lang/" /> <item debugWay="console" /> <item debug="false" /> <item debugFwk="false" /> <item debugBinding="false" /> <item debugLaunchMethod="false" /> <item showTiming="false" /> <item debugUrl="false" /> <item useLang="false" /> <item langFileExtension="conf" /> <item langParseMethod="flat" /> <item defaultLang="fr_FR" /> <item useDynCompression="true" /> <item dynCompressionUrl="WZFwk_multiton/php/dyn/dyn.php" /> <item usePacker="true" /> <item useCache="true" /> <item compressedName="compress" /> <item viewFileExt="html" /> <item getSuffix="get_" /> <item setSuffix="set_" /> </framework> <application> <tag1> <item myApplicationName="myFirstProject" /> </tag1> <mysecondtag> <item myApplicationNumber="42" /> </mysecondtag> </application> </items>
items description
version
This item represents the version of your application. It will be used at the end of the downloaded file to kill client cache.
Example with the file below, when the framework will download a file like http://localhost/js/application/mvc.xml, it will add at the end ?v=1.0.7.
http://localhost/js/application/mvc.xml?v=1.0.7
mvc
This is the URL corresponding to the file containing the description of you application. See the mvc.xml section for more information.
baseUrl & addBaseUrl
This is the base URL that will be added to urls used by the framework if addBaseUrl is set to true.
Example with the file above, when the framework will check the URL WZFwk_multiton/, it will detect that it is not a full URL and add the baseUrl as a prefix.
WZFwk_multiton/ will result http://localhost/js/WZFwk_multiton/ because no http prefix http://localhost/WZFwk_multiton/ will result http://localhost/WZFwk_multiton/ because http prefix detected
useUrl
This is the tag that will say if you are using the UrlManager or not. Take a look at the URL section for more information.
langFolder
This is the URL of the folder that contains your lang file. Take a look at the Lang section for more information.
fwkFolder
This is the URL to the folder containing the framework.
pluginFolder
This is the folder containing all the plugin that will be used by the framework. An example of plugin could be Scriptaculous or a modal window class. Take a look at the plugin section for more information.
langFolder
This is the folder containing the lang file.
debugWay
When you develop an application, it is important to be able to debug. This item could have two value : console or popup. If you choose console and you are using firebug, message and error will be shown there. If you choose popup, a popup will show and message will be log there. The best way to debug is console (see debug section to know how to use firebug on IE or other browsers).
debug
Says if you are activating the debug or not. Can be either true or false.
debugFwk
Says if you want that the framework tells you what he is doing. Can be either true or false.
debugBinding
Says if you want that the framework tells you what he is doing when he is doing bindings. Can be either true or false. If you set it to true, it could really slow down your application.
debugLaunchMethod
Says if you want that the framework tells you what he is doing when the controller helper is calling the model helper and vice versa (ie launchControllerMethod and launchModelMethod). Can be either true or false. If you set it to true, it could slow down your application.
showTiming
Says if you want that the framework shows you some timing when he is doing things. It will show you bind time, bindListener time, module loadings time... Can be either true or false.
debugUrl
Will activate the debug mode of RSH. Can be either true or false.
useLang
This item tells the framework if it has to load a lang file or not (is it a multilangages application ?). Can be either true or false.
langFileExtension
This is the extension that will be added at the end of the lang file.
Example with the file below, when the framework will load fr_FR file, it will add .conf.
fr_FR + conf will result fr_FR.conf
langParseMethod
This describe how you did your lang file. Can be either flat or xml. See more information on the lang section.
defaultLang
The default lang.
lang
The lang of your application.
useDynCompression
This tells to the framework if he should use compression for the application you have developped using the framework. See compression section for more information
dynCompressionUrl
The URL were the framework can find the dynamic compression tool.
usePacker
Packer is a tool that compress JS file. The PHP part of the framework can use packer when he is using dynamic compression. Using packer without cache could slow down your app. But if you are planning to use packer with you app in production, you have to test it (packer doesn't like when you forget some ; at the end of lines). Can be either true or false.
useCache
When you are using the dynamic compression, you can ask the PHP part of the framework to cache the result. So next time a client ask for the file, the delivery is very fast. Can be either true or false.
compressedName
If you are not using dynamic compression (because you have not PHP :P), you can do your own compressed file containing for each module the model helper and the controller helper. The name of this file is what we call the compressedName.
viewFileExt
With a model helper and a controller helper, you can specify a view. This is the extension added at the end of the view.
getSuffix & setSuffix
When you define binding value in the module conf file, you will have to access them in the model. This is the prefix added to these value.
If you define in your module conf file this :
<bind id="button" attribute="innerHTML" propertie="buttonValue"/>
And you define in your framework conf file that :
<item getSuffix="get_" /> <item setSuffix="set_" />
To set 42 in the innerHTML of the element with id button, you will do :
this.set_buttonValue('42');