0

I have a controller file with the two actions i.e :

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }

    public function doLoginAction()
    {
        // action body
    }
}

and their corresponding view files. i.e when i hit http://www.mydomain.com/index it loads the index view. The problem I am facing is that when I try to access the index action of this controller it will load the corresponding view but when I try to hit the dologin action it gives the error

http://www.mydomain.com/index/dologin

*Message: Action "dologin" does not exist and was not trapped in __call()*

Request Parameters:

array (
  'controller' => 'index',
  'action' => 'dologin',
  'module' => 'default',
)  

same is happening when I try it with another controller and action. The index action runs fine for that controller too but not any other action in the controller.

P.S : I have configured mod_rewrite module and AllowOverride ALL in apache config file

Petar Minchev
  • 46,889
  • 11
  • 103
  • 119
Faizan Ali
  • 509
  • 12
  • 35
  • I think it was something to do with dologin. may be its a reserved key word. because when I make a new function with someother name it is working fine – Faizan Ali May 02 '12 at 12:35

2 Answers2

0

Camel-cased action names are expected to be dashed as params. Therefore, doLoginAction() will respond to /default/index/do-login, not dologin. If you wish the URL to be dologin, you should rename the action to dologinAction().

shrikeh
  • 661
  • 9
  • 12
0

You can have hyphen(-) separated urls at controller level also.

Suppose you need a url like this:

http://www.mydomain.com/do-some-stuff/my-stuff/

Then your controller should be named as:

DoSomeStuffController (as class name) && DoSomeStuffController.php (as controller file name)

and

myStuffAction() (as your method name)
vsingh
  • 470
  • 4
  • 9