-- ashish.sharma <[EMAIL PROTECTED]> wrote
(on Sunday, 10 February 2008, 11:27 PM -0800):
> Hello Everybody, I would like to know that can we use underscores in URL
> (specially in controller & action) like can we have a URL like .. Http://
> localhost/my_application/my_module/my_controller/my_action As ZF removes
> underscores from the controller and action automatically. Do we have any
> alternative / solution for this, so that we can use underscores in controller
> and action name. looking for your suggestion ... Ashish

Currently, there are two rules in play:

 * When referring to controllers, underscores are used to indicate that
   the controller lives in a subdirectory. In your example,
   'my_controller' refers to a module living in
   'My/ControllerController.php' in the module directory.

 * When referring to modules and actions, underscores are one of three
   "word separators". Within the dispatcher, these are transliterated
   such that the words are camelCased and smashedTogether. In your
   examples, my_module becomes myModule, and my_action becomes
   myActionAction().

You can alter these within the dispatcher pretty easily by calling the
setPathDelimiter() and setWordDelimiter() methods of the dispatcher.
>From your bootstrap, try the following:

    $dispatcher = $front->getDispatcher();
    $dispatcher->setWordDelimiter(array('.', '-'))
               ->setPathDelimiter('');

The above sets the word delimiters to solely the '.' and '-' characters,
and effectively disables path delimiters.

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to