I have a controller file with the two actions ie :
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. ie 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.
PS : I have configured mod_rewrite module and AllowOverride ALL in apache config file
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().
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.