Monthly Archives: March 2011

Adding a custom resource type to the Zend Framework autoloader

I’m working on a new project using the latest Zend Framework. I’ve got a modular application and decided that I wanted to hold my module-specific logic classes in their own ‘logic’ subdirectory.

Setting up class to folder mappings is done inside ‘Zend/Application/Module/Autoloader.php’ in the function ‘initDefaultResourceTypes’. In here you’ve got your standard mappings like ‘Form’ => ‘forms’, ‘Model’ => ‘models’ etc.

You’ve either got the choice of overriding this class with your own implementation, or you add your own resource types by putting the following code in your application or module bootstrap:

class MyApp_Bootstrap extends Zend_Application_Module_Bootstrap
     * Add some custom resource types to the resource loader
     * @return void
    protected function _initLoaderResource()
            'logic' => array(
                'namespace' => 'Logic',
                'path'      => 'logic'

This will make the autoloader look inside the logic subdirectory for any classes with the namespace ‘MyApp_Logic’

Arduino rover – almost there

Here’s the first build of my Arduino powered rover. (edit: content is now lost, removed the image!)

I’m going to write an instructable on how this was built but for now here’s the partsĀ  list.

Arduino Uno – Programmable Microcontroller
ProtoX – prototyping shield for Arduino
L293NE – Quadruple Half-H Driver
1x Remote Control car, stripped down to the chassis and 2x 3v motors
1x battery holder with 4x3v batteries