This chapter will explain the what, how and why of First Module. We will also create a module using the Webserver Pattern.
If were awake during the previous chapter, you noticed that the [moduleroot]/module.xml file contains most of the meat. It does in fact have two main purposes:
Define your module.
Define the ROC layout of your module.
Number one is obvious, and number two is important. If your ROC layout is done well, putting the rest of your module together will be easy (and short). So let’s study it in detail.
Let’s start with a simple module.xml template.
<module version="2.0"> <meta> <identity> <uri>urn:org:yourcompany:yourapplication:newmodule</uri> <version>0.0.1</version> </identity> <info> <name>New Module</name> <description>New Module Template</description> </info> </meta> <system> <dynamic/> </system> <rootspace> </rootspace> </module>
Having good templates available can seriously reduce your development time. You do not need a fancy system to manage them, though some editors have one, and if you feel comfortable with it, by all means use it. A simple directory will do. Make sure to put them under version control as well though!
The template contains nothing special:
This contains the description of your module. Do note the use of colons in the URI.
<system><dynamic/></system> we indicate two things:
Any change to [moduleroot]/module.xml will cause a hot reload of the module. ...