HomeMySQL Data Management Made Easy Using Nennius: Creating a Web Application
Data Management Made Easy Using Nennius: Creating a Web Application
Previously, we took a look at the Nennius engine and discussed several out-of-the-box features available to PHP developers. Now we are ready to create our own Nennius web application, and so we will discuss all of the steps necessary to do that.
If you wish to follow along, please download a copy of the Nennius engine from Source Forge (http://sourceforge.net/projects/nennius). At the time of this article the recommended version is 1.9 B. If you would like to learn more about the Nennius project after reading this article, please visit the Nennius website (http://nennius.sourceforge.net).
Initializing a New Nennius Application
Similar in some respects to Tomcat, Nennius is itself an application engine. In turn, it allows developers to create multiple, fully-customizable web applications that may be run simultaneously on top of a single instance of the engine. Each web application resides in a folder located within the /nennius/webapps/ directory. So the first step in creating a Nennius application is to create a folder within that directory. For the purposes of this article, we will develop a basic web application that manages news releases for a corporate website. Our folder will be named news.
Once our folder has been created, the next step is to define a basic configuration for our application. The Nennius bundle includes a sample web application, and I recommend that users make a copy of the application.defaults.php file provided with that example when creating a new app. We will want to make a copy of this file with the same name and place it into our news directory. The purpose of the defaults file is to define basic values for all application variables (editable and non-editable). These values will then be used by the Nennius engine to drive the application.
(Note: it is recommended for advanced projects that the developer also create a file named application.config.php to store all editable values. This config file then allows a user to customize certain variables to his or her pference, while leaving the initial configuration un-touched. This is important for several reasons: it keeps editable variables separate from non-editable variables, and it also allows for an easy start-over point in the instance that the config file itself is somehow corrupted.)
The last step in initializing a Nennius web application is defining a menu. This can be done for now by copying the file /nennius/webapps/welcome/config.menu.php into our news folder, and then modifying it to fit our purposes. We'll come back to this shortly, but first let's take a look at how to setup our basic configuration.