Much more professional approach this is, if you need it everywhere...

Bart

Rob Allen schreef:

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 = ""
    }
}

and in your bootstrap:

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


Regards,

Rob...


--
Bart McLeod
Space Web Internet Team
Middenlaan 47
6865 VN Heveadorp
The Netherlands
t +31(0)26 3392952
m 06 51 51 89 71
@ [email protected]
www.spaceweb.nl
zce logo zce PHP 5 logo

Bart McLeod is a Zend Certified Engineer.

Click to verify!

Reply via email to