Skip to main content

How to get controller,action,module,router name?


If you are in .phtml file use this code:
  $this->getRequest()->getActionName();
 $this->getRequest()->getControllerName();
 $this->getRequest()->getRouteName();
 $this->getRequest()->getModuleName();
 If you in class file use this code:

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

 For More :
 echo "<pre>";
  print_r(Mage::app()->getRequest());
  echo "</pre>";

Comments