Zend Framework: How to include directories with dash or hyphen

So before I can forgot it in Zend, I will post this as a notes and reference.
When you want to include a directory with dash or hyphen (-) symbol, like for example, a helper. You can do it by using the code below.


        
    protected function _initActionHelpers()
    {   
        Zend_Controller_Action_HelperBroker::addPath(
            APPLICATION_PATH . '/../library/dash-classes/Action/Helper/',
            'DashClasses_Action_Helper'
        );
    }

Where you have your helper stored in ../library/dash-classes/Action/Helper/Example.php

Where your Example.php might look something as,


class DashClasses_Action_Helper_Example extends Zend_Controller_Action_Helper_Abstract
{
    function direct()
    {
        $session = new Zend_Session_Namespace('exampleSession');
        return $session;
    }
}

Comments

Popular posts from this blog

Using Oracle 11g thru VirtualBox appliance in Mac OS X Lion

Use Shell Editor for Eclipse for editing bash, ksh, csh in Unix/Linux system

LVM: How to remove a volume using pvremove