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.
Where your Example.php might look something as,
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.phpWhere 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