Depending on the area (frontend or adminhtml), a frontend or adminhtml router is sent.
Therefore, you donβt have to worry about being confused as long as you use different controller files for frontend and adminhtml, the frontend controller extending from Mage_Core_Controller_Front_Action and adminhtml extending from Mage_Adminhtml_Controller_Action .
Frontend / Adminhtml routers can be defined as (just syntax):
<frontend> <routers> <[module]> <use>standard</use> <args> <module>[Namespace]_[Module]</module> <frontName>[module]</frontName> </args> </[module]> </routers> </frontend> <admin> <routers> <[module]> <use>admin</use> <args> <module>[Namespace]_[Module]</module> <frontName>[module]</frontName> </args> </[module]> </routers> </admin>
And you can create interface controllers under: app/code/[codePool]/[Namespace]/[Module]/controllers/
For instance:
<?php //file: app/code/local/MagePsycho/Testmodule/controllers/IndexController.php class MagePsycho_Testmodule_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction(){ } }
To access it from the URL: http://your-magento-url/testmodule/index/index
and adminhtml controllers: app/code/[codePool]/[Namespace]/[Module]/controllers/Adminhtml/
For instance:
<?php //file: app/code/local/MagePsycho/Testmodule/controllers/Adminhtml/IndexController.php class MagePsycho_Testmodule_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action { public function indexAction(){ } }
To access it from the URL: http://your-magento-url/testmodule/adminhtml_index/index
(You can see the Adminhtml folder to separate adminhtml controllers)
Hope this gave you some info.
Thanks
source share