I would like to know that can we use underscores in URL (specially in controller & action) like can we have a URL like ..
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.sharma <[hidden email]> 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
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:
I don't know how much this will help, but what you set in your bootstrap
has nothing to do with zend tool.
Zend tool operates according its own providers and does not take any
insight from your application
You can try to create the controller manually but I think you will have
only headache if you use underscore in its actual name.
You are better off with using routes to point underscore links to
On 03/08/2011 06:53 PM, tkuben wrote:
> I am trying to create a controller with an underscore. I've added the
> specified code to my bootstrap:
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
> protected function _initDoctype()
> $dispatcher = $front->getDispatcher();
> $dispatcher->setWordDelimiter(array('.', '-'))->setPathDelimiter('');
> However, when I do the following: zf create controller press_release
> I still get Note:
> PHPUnit is required in order to generate controller test stubs.
> An Error Has Occurred
> Controller names should be camel cased.
> Zend Framework Command Line Console Tool v1.11.4
> Details for action "Create" and provider "Controller"
> zf create controller name index-action-included[=1] module
> Any thoughts.
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/underscore-in-URL-tp648359p3341777.html > Sent from the Zend Framework mailing list archive at Nabble.com.