Create a Module
n2n has a modular structure. In this chapter we show you how you can create your own n2n modules. To create a module you only have to create the required directories.
Required Directories
To create a module you have to create a new subdirectory in the app directory. The name of the folder is the namespace of the module. So that it is recognized by n2n, you have to create a subfolder with the name of the namespace in the var/etc directory. With the creation of this subfolder the module is installed. Furthermore we recommend creating a subfolder with the namespace under public/assets/ as well. Here all images, JS and CSS files that your module needs can be stored.
In summary, the following folders are required to create a module:
app/[module-namespace]var/etc/[module-namespace]public/assets/[module-namespace](optional, but recommended)
Attention
You can also create a module in several subfolders: e.g.
app/ch/n2n/example. In this case the namespace for this module would bech\n2n\example. Note that in this case you have to create the foldervar/etc/ch-n2n-examplein theetcdirectory. The backslashes of the namespace are replaced by hyphens.
Recommended Module Structure
n2n works with namespaces. Therefore the developer is free to choose the structure within his module directory. In principle we recommend the following subfolders:
/bofor business objects/controllerfor all controllers/modelfor all models/viewfor all views
It is possible without problems to create additional folders. For large modules we recommend creating subdirectories within the directories mentioned above, which improve the clarity.