Magento get Controllername Modulename
Magento get Controllername Modulename, Actionname and last Routename with below one line code
<?php Mage::app()->getRequest()->getControllerName(); // return controller name Mage::app()->getRequest()->getActionName(); // return action name Mage::app()->getRequest()->getRouteName(); // return routes name Mage::app()->getRequest()->getModuleName(); // return module name ?>
Few example as below
if(Mage::app()->getRequest()->getControllerName() == 'category'){ /* do something */ }