Magento – Get current module name, route name, controller name and action name

Tech Bandhu

Many time we required to get current controller or action name or module name. Its very easy job to get get route name, module name, controller and action name for magento from current URL, anywhere in controller or even with template files.

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

View original post


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s