On 19 Jan 2009, at 08:01, Bart McLeod wrote:

in your action controller:
$this->view->actionName = $this->getRequest()->getActionName();

in your view:

you can download <?= $This->actionName ?> free from...


If you need this in all your views, you can also automate it with a plug-in:

class App_Controller_Plugin_ViewSetup extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
    {
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
        $viewRenderer->init();

        // set up variables that the view may want to know
        $viewRenderer->view->module = $request->getModuleName();
$viewRenderer->view->controller = $request- >getControllerName();
        $viewRenderer->view->action = $request->getActionName();
    }
}

and in your bootstrap:

$frontController = Zend_Controller_Front::getInstance();
$frontController->registerPlugin(new App_Controller_Plugin_ViewSetup());


Regards,

Rob...

Reply via email to