I was thinking about how to add theme support to an application that makes use of the Zend_Layout component. When i came across the Zend_Filter_Inflector class. This looks interesting. From teh ZF manual:
Zend_Filter_Inflector is a general purpose tool for rules-based inflection of strings to a given target.
This little class makes it easy to convert string to for instance paths. Anyway. i was trying to configure this class in my Bootstrap class. And run into some problems. I was testing the example in the manual. which makes use of the Zend_Filter CalemCaseToUnderscore. But when i reloaded my page instead of the usual output i was treated by an error.
$inflector = new Zend_Filter_Inflector(':script.:suffix');
$inflector->setRules(array(
':script' => array('CamelCaseToUnderscore'),
'suffix' => 'html'
));
Zend_Loader_PluginLoader_Exception: Plugin by name CamelCaseToUnderscore was not found in the registry. in Zend\Loader\PluginLoader.php on line 370
When i looked at the structure of the Zend folder. I noticed the CamelCaseToUnderscore filter was not available in the root of the Filter directory. Instead it’s placed inside the Filter/Word directory. So i prefixed the class name with Word_. And this works fine. The code now looks like this.
$inflector = new Zend_Filter_Inflector(':script.:suffix');
$inflector->setRules(array(
':script' => array('Word_CamelCaseToUnderscore'),
'suffix' => 'html'
));
it’s a minor issue but i reported it anyway.
Twitter
I am Thijs Lensselink a Webdeveloper from the Netherlands.