first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Zend Framework: Mapping the Same View to Multiple Controller Actions

This is the form for mapping one or more Controller actions to a View:

class MyController extends Zend_Controller_Action
{
    public function preDispatch()
    {
        //Disable conventional calls to views for whole class:
        $this->_helper->viewRenderer->setNoRender();
    }

    public function myAction()
    {
        ...
        $this->render('myview');
    }
}

Alternatively, you can map an entire Controller class to one View:

class MyController extends Zend_Controller_Action
{
    public function preDispatch()
    {
        $this->_helper->viewRenderer('myview');
    }
}
mod date: 2008-08-24T07:00:47.000Z