0

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';

Joshi
  • 2,730
  • 5
  • 36
  • 62
  • Possible duplicate of [PHP: "Notice: Undefined variable" and "Notice: Undefined index"](http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) – scrowler May 30 '16 at 02:40
  • What you've posted here [works fine](https://eval.in/579046). You've probably missed something silly :) – scrowler May 30 '16 at 02:41
  • If you have live url then provide to us. and please remove space between method and brackets. – Sunny Rathod May 30 '16 at 05:44
  • @RobbieAverill - Yes after long hit & try, I could get the output using `mysite.com/test/index/mamethode`. but `mysite.com/test/mamathode` still 'doesn't work, but other pages in the site works fine without using `/index/` . What could be the reason for the same? – Joshi May 30 '16 at 08:29

1 Answers1

1

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