Finding Controller, Module, Action & Router Name In Template (phtml) Files:
1. Get Controller Name In Template Files:
$this->getRequest()->getControllerName();
2. Get Action Name In Template Files:
$this->getRequest()->getActionName(); //the function inside the controller
3. Get Router Name In Template Files:
$this->getRequest()->getRouteName();
4. Get Module Name In Template Files:
$this->getRequest()->getModuleName();
Finding Controller, Module, Action & Router Name In Class Files:
5. Get Controller Name In Class Files:
Mage::app()->getRequest()->getControllerName();
6. Get Action Name In Class Files:
Mage::app()->getRequest()->getActionName();
7. Get Router Name In Class Files:
Mage::app()->getRequest()->getRouteName();
8. Get Module Name In Class Files:
Mage::app()->getRequest()->getModuleName();
These functions i.e. getControllerName, getActionName, getRouteName, getModuleName are present in the class Mage_Core_Model_Url, you can display all the results by using the print_r();
like as
echo "<pre>"; print_r(Mage::app()->getRequest()); echo "</pre>";
This is all about How we can get Controller, Module, Action & Router Name In Magento, Hope this would be helpful, Thanks and Enjoy the coding.