How to Get Current module name, controller name, route name and action name in Magento?

Magento Get current module name, controller name, route name and current action name
To find these important values you need to understand the use of below code with effective measures. With this code you can find the values from current URL anywhere in controller or even at template files.


Magento Get current module name:

Mage::app()->getRequest()->getModuleName();
// will return current module name

Magento Get Current Route Name:

Mage::app()->getRequest()->getRouteName();
//will return routes name

Magento Get Current Controller Name:

Mage::app()->getRequest()->getControllerName();
// will return controller name

Magento Get current Action name:

Mage::app()->getRequest()->getActionName();
//will return action name

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *