Magento – How to get current router module controller action ?

You can easily know “where you are” using these fonctions :

in template / block files

$this->getRequest()->getRouteName();
$this->getRequest()->getModuleName();
$this->getRequest()->getControllerName();
$this->getRequest()->getActionName();

in class files

Mage::app()->getRequest()->getRouteName();
Mage::app()->getRequest()->getModuleName();
Mage::app()->getRequest()->getControllerName();
Mage::app()->getRequest()->getActionName();

Leave a Reply