Joshi
Joshi

Reputation: 2790

magento module error in controller

I have this simple code in my magento local controller

<?php
class Pfay_Test_IndexController extends Mage_Core_Controller_Front_Action
{
   public function indexAction ()
   {
     echo 'test index';
   }
   public function mamethodeAction ()
   {
     echo 'test mymethod';
    }
}

When I am accessing the index action it is working quite fine but when I am using mysite.com/test/mamethode

I am getting this error

[Mon May 30 00:31:28 2016] [warn] [client 117.247.67.136] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /var/www/clients/client102/web170/web/app/code/local/Pfay/Test/controllers/IndexController.php on line 11

line 11 is echo 'test mymethod';

Upvotes: 0

Views: 62

Answers (1)

Asheesh Kumar Singh
Asheesh Kumar Singh

Reputation: 86

According to native magento routing mysite.com/{{module_frontname}}/{{controller_name}}/{{action_name}} So if you call mysite.com/test/mamethode/ (or say mysite.com/test/mamethode/index/) it will try to load controllers with name MamethodeController.php in test module and call the indexAction()

But as i can see your controller name is IndexController.php So right calling syntax would be mysite.com/test/index/mamethode (because mamethode is the action name so you have to supply at 3rd postion not in 2nd).

Upvotes: 1

Related Questions