The mvc configuration file
What's in it ?
For each application you are developping with the framework, you will have a mvc.xml file. This file list all the module that are in your application. Act carefully when editing the XML file : do not break it !
Let's take a look
Here is an example of a mvc.xml file :
<?xml version="1.0" encoding="utf-8"?> <files> <item id="Module1" file="application/module1/conf.xml" executeAtInit="true" /> <item id="Module2" file="application/module2/conf.xml" executeAtInit="true" /> <item id="Module3" file="application/module3/conf.xml" executeAtInit="true" requireId="myId" /> <item id="Module4" file="application/module4/conf.xml" executeAtInit="false" /> </files>
As you can see, this application has four module : Module1, Module2, Module3 and Module4.
Three of these modules have to be loaded when the application starts (Module1, Module2 and Module3). executeAtInit is set to true
The fourth one (Module4) will wait until you ask the framework to load it (executeAtInit is set to false).
For module Module3, the framework will check if an element with id myId exist in the DOM before loading it. If he finds it, he will load the module. If not, no loading.
Attributes description
id
Required. This is the id of your module. An id is unique for each module.
file
Required. This attribute specify where the framework will find the full description of the module. We are talking about the module configuration file.
executeAtInit
Required. This attribute specify to the framework if this module has to be loaded at the initialisation of you application. If you set it to false, the framework will wait that you ask him to load the module. See the Controller section to know how to do that.
For example, if you are using modal window in you application, you don't need to load the content of the modal before it shows up to the user. So you can set executeAtInit to false.
This means you can dynamically load module on demand. This is really useful to speed up the initialization of your application.
requireId
Optionnal. If you set this attribute, the framework will check that an element with the id specified exists in the the DOM before loading it. If he finds it, it loads the module. If not, no loading.