Magento (v1.x) : Show full page action name (module_controller_action)

Sometimes, when editing a page you need to know what the full module_controller_action route is so you can modify the correct blocks in the layout files.  Here is a simple bit of code to display the full action name in the form of module_controller_action.


<?php echo $this->getRequest()->getModuleName() . “_” . $this->getRequest()->getControllerName().”_”.$this->getRequest()->getActionName(); ?>

This will return something like:

catalog_category_view

or

cms_cms_index

These form the block identifiers in the layout files such as shown below and can be a real help when making changes/debugging layout problems.

<catalog_product_view translate=”label”>
<label>Catalog Product View (Any)</label>
<!– Mage_Catalog –>
<reference name=”root”>
<action method=”setTemplate”><template>page/product-layout.phtml</template></action>
</reference>

</catalog_product_view>

Facebook Comments

Leave a Reply

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

Apply your human brain cells and complete this highly complicated maths problem *