- 2012-08-19: Working on the new Drupal 8 Entity system at Drupalcon Munich
- 2012-06-15: Working on the new Drupal 8 Entity system at DrupalDevDays Barcelona
- 2012-03-23: Working on the future Drupal Document Oriented Storage at DrupalCon Denver. D8 or later ? Bets are on.
- 2011-09-01: Building an Unfuddle to Drupal Casetracker import module using Migrate
- 2011-08-28: Back from DrupalCon London and its WSCCI code sprint. Wow.
- 2009-11-29: mongodb_watchdog module created by dereine, ported to D7 by me in about half an hour, and migrated in a larger MongoDB project by damz before the hour ended. Wow...
Multiple entries with Zend_Config_XML
I had been in need of a class to read config data into both the
PHP-GTK OSInet back-office front end, and the back-office client UI
for the Drupal 5.x
offload module, and hesitated
between various solutions, ranging from roll-our-own to the various
frameworks out there and the existing PEAR packages.
Since Zend Framework appears to be well on its way to becoming a standard for professional PHP developers, I figured I'd give it a spin :
- work notes within Zend Framework (ZF) regularly allude to CLI and GTK, although I could not find any concrete example about using ZF classes within a PHP-GTK app
- ZF includes a tempting
Zend_Configclass, which seems to cover our needs in a simple fashion
The good news is that it works like a charm, although ZF has not
yet reached version 1.0. The
Zend_Config_XML manual page is sufficient to demonstrate how to use the
code, but skips an important point : configuration files frequently
have to include a list of values. A time honored practice in INI files
is to number variables and read them in until failure occurs.
Zend_Config_XML parses the file,
I figured it might be more useful to declare the list and use it
directly, so here is a sample config file for the
And here is the simplistic code that loads the table list:
$window = new GtkWindow();
/* ... skip vanilla PHP-GTK initialization ... */
$filename = 'offload_conf.xml';
$config = new Zend_Config_Xml($filename, 'offload');
$tables = explode(',', $config->tables->list);
/* ... skip further processing ... */
$tables now contains the list of tables.
No need for a loop of test, just a simple array