Skip to content
Apr 16 / markg85

MageDB progress update: Zend components

Hi,

In the last few days, specially the last few hours, i’ve testes out some “new” technologies from the Zend Framework. I was already planning on using Zend for the DB an Cache and perhaps a few others but now i’ve discovered the features of: Zend_Regitry and Zend_Translate.

The Registry object is a smart way of accessing variables globally in a nice way (through the use of a static class). I was always wondering how i could get rig of global variables in php in some cases or adding extra getters/setters to classes in order to give them the data they need. Zend_Registry seems to be providing a nice new clean way for global variables.

The Translate object is really nice as well. That object allows me to make MageDB a multi-language script. I did a few tests with it and it seems to be working very nice. The language files where going to be gettext files but that seemed a bit annoying to make so i picked a ini based style.

Now for some other MageDB progress. I am currently working on building up the file view page. And just to give you an idea of how this was going under paFileDB:

They fetched the raw sql data in php and practicly dumped that to smarty where a loop was done to display it all where they manually looked up for every possible setting. That is all fine but the issue there was that it required if/else statements in the templates! and that’s something you want to avoid as much as possible just so that making a new theme is as easy as possible.

Now MageDB is doing it a bit different. In php all data is fetched, like in paFileDB, but i loop through all the data in PHP, filter/modify it all i want, make a nice array with all the new data and that array will be pushed in the template engine (Dwoo). Sadly this won’t prevent all if/else statements but it will prevent a lot from being needed in the templates because they are all already done in the php code. Things where if/else statements are needed are with the screenshots. I can’t give a array of marked up screenshots because that would be html inside php and that’s exactly the thing i try to prevent in MageDB by using a template engine.

All in all the progress isn’t going fast, but coming along quite nicely in this rate.

I will post some more progress sometime later this week.

Cya,
Mark

Leave a Comment