phpmodel-view-controllerzend-frameworkzend-viewzend-controller

Zend framework : no other Action except index action in the controller is callable


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


Solution

  • 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().