🎉 6DollarCRM is a low-cost, high-value CRM for small businesses. 🎉

Zend Framework Tip - Getting Controller and Action Names

Although it's possible to use multiple controller- and even action-specific layouts within your Zend Framework application, sometimes it can be easier to employ a bit of logic within a single layout in order to render custom content. In order to do so you'll need to know which controller and action are currently executing, and then use an if-conditional to render the desired output. You can determine the names of the controller and action using the following static methods. To obtain the action name:

Zend_Controller_Front::getInstance()->getRequest()->getActionName()

To obtain the controller name:

Zend_Controller_Front::getInstance()->getRequest()->getControllerName()