How to get controller name or action in view or layout

To get the controller name in view or layout use the below function

 $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName()

To get action

 $action =  $controller = Zend_Controller_Front::getInstance()->getRequest()->getActionName()


Zend Framework - Get the last url parameter

 In the controller,

   $requestUri = $this->getRequest()->getRequestUri();
   $lastParameter = substr($requestUri, strrpos($requestUri,'/')+1);

Using same view for different modules in zend framework

In the Controller Action we can specify the view path then use helper to load view in the specified folder

class IndexController extends Zend_Controller_Action{

 public function indexAction()
    {
        $this->view->setScriptPath(APPLICATION_PATH.'/modules/modulename/views/scripts/controllername');
           $this->_helper->viewRenderer->setNeverController(true)->setRender('index');
     }
}

I hope there is no default method like $this->_forward('module', 'controller', 'action')