-- Ovidiu EFTIMIE <[EMAIL PROTECTED]> wrote
(on Friday, 04 April 2008, 07:42 PM +0300):
> I have a question concernig the usage of numbers as directory names for
> modules.
> For example my application structure requires me to have urls like this
> http://servername/1.0/controller/action
> http://servername/1.1/controller/action
> http://servername/1.2/controller/action
> and I thought that this coud be managed by different modules respectively
> application/
> |---1.0
> |----controllers
> .........................................
> |---1.5
> |----controllers
> |----models
> |----views
> The problem is that when I specify in the bootstrap file the
> application module directory addModuleDirectory('../application') and
> try to go to a URL like this http://servername/1.3/news ZendFramework
> tries to locate a class 13_NewsController which obviously it's not a
> correct name for a class.
>
> Does anyone have any ideea how this isse can be handeled ?
Zend_Controller_Dispatch_Abstract::_formatName() looks like this:
protected function _formatName($unformatted, $isAction = false)
{
// preserve directories
if (!$isAction) {
$segments = explode($this->getPathDelimiter(), $unformatted);
} else {
$segments = (array) $unformatted;
}
foreach ($segments as $key => $segment) {
$segment = str_replace($this->getWordDelimiter(), ' ',
strtolower($segment));
$segment = preg_replace('/[^a-z0-9 ]/', '', $segment);
$segments[$key] = str_replace(' ', '', ucwords($segment));
}
return implode('_', $segments);
}
I'd suggest extending Zend_Controller_Dispatcher_Standard with your own
subclass, and overriding that particular method -- in particular,
changing the regex used in the segments loop to include the '.'
character.
You can then register your custom dispatcher with the front controller
using Zend_Controller_Front::setDispatcher().
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/