Zend Framework Multiple Word Controller / Action

Although this is a very simple tip but I didn’t know this until I actually tried it. Before I used multiple word controllers or actions in Zend Framework, I used the convention below.

If I have a controller named “SmartModule”, I named them this way:

PHP file = SmartmoduleController.php
Controller class = SmartmoduleController
URL = /smartmodule

As you can see, I tried to avoid the suppose to be nice naming convention so that I will not have a problem with them on the URL. But just yesterday, I tried to experiment with it.

PHP file = SmartModuleController.php
Controller class = SmartModuleController.php
URL = /smart-module

As you can see, the DASH “-” symbol handles the multiple word names on URLs. It applies the same to Actions.

Action = addModuleAction()
URL = /smart-module/add-module

So now I know…

This entry was posted in Zend Framework and tagged , , , . Bookmark the permalink.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *