What is the NDBE?
The acronym NDBE stands for Neomueller DataBase Editor, or NDBE DataBase Editor if you think an open source project just has to have a bacronym for a name. The 'Neomueller' comes from the domain name neomueller.com, a site we created in our spare time during university that celebrates all things anime, coding and whatever else strikes our fancy. Very early on we decided that it was time consuming to create custom forms, etc, to enter data for the various SQL-driven components of the site. To that end, one of us, Mike, decided that this was just plain Stupid(tm) and created the basic framework that eventually became the NDBE.
You see, he didn't just create a generic, customizable online database editor. That would have been too simple. He created a system which also included a generic API through which the data we entered could be accessed and manipulated, and in such a way that if used the this API, we could move to a database system other than MySQL (which we were using at the time, and still are) without having to rewrite the entire site. So when you get right down to it, the NDBE is two major components designed to work together:
The first is accomplished through the afore-mentioned programming API. You can execute queries, access result sets, etc. all through a common interface, regardless of what database system is actually running at the back end. By including the base script /ndbe/ndbe.php, you can access any database on your system so long as you have configured a connection. These connections are used by both the editor (more on that in a minute) and any PHP code you write that accesses the data through the NDBE API.
The second part is an online database content editor. Using the same connection established for the API, the editor will allow you to browse, add, edit & delete content. You can find a demonstration of this over in the demo area. The editor is not just an editor, however; it is a full online GUI that lets you create new connections, edit & delete existing ones, change editor settings, hide & disable connections and even modify the way a table in a database is displayed and editted!
It is this latter point in which the true power of the NDBE starts to shine; the NDBE works on a system of special datatypes. For each field in a table accessed through a connection, there is a configuration file (automatically generated for mSQL & MySQL, pending on PostgreSQL) that dictates just how each database field is represented in the editor. You see, we didn't just create an NDBE datatype for each real database field type; we created a whole lot more!
Okay, it probably sounds confusing. You're asking "What the hell are you talking about?". What I'm talking about is this: we created an NDBE datatype for each of the standard database field types. For example:
But what I'm saying is we didn't stop there. Say you were using a varchar field to store website links. If you just display a text input, you have to trust that the user (maybe you, maybe someone else you want entering data) will enter the URL in such a way that it is in the proper syntax. For example:
A better way would be to use one of the special NDBE datatypes such as NDBType_URL. This type breaks down the different parts of an URL. For example:
Now, this is just an example. There are over 35 NDBE datatypes at present and some are fairly complex:
Furthermore, it's relatively easy to write new datatypes! You just create a script named NDBType_[your datatype].php, inside of which you should include a class of the same name extending NDBType_Base. Voila! It may not do much to start, but with a few overriden methods you'll have a new NDBE datatype of your very own! You'll be surprised at just what is possible once you start exploring the capabilities this system contains. Just open up some of the existing datatypes and use them as examples.
Lastly, but certainly not least, is the framework that puts these two components together: NEditor. This is a small set of classes (though one or two are quite large) that drive the entire online editor. If you do not like the look, feel, or even functionality of the NDBE editor, you can feel free to write your own. I won't lie to you and say it's easy; but the NEditor classes will give you a huge head start on getting it done. So much so that after experimenting with the classes a little you may find that there are many, larger purposes to which the NEditor classes can be bent. We ourselves have used NEditor in ways we never intended it to be used. It can be used to tap into the NDBE datatypes and used to create complex input forms and online systems much more rapidly than doing so from scratch. Dip into the existing library of interface components through NEditor and you'll be amazed at what's already done for you!
|View source for this page|