Search code examples
model-view-controllerzend-frameworkzend-view

getting filename on Zend_View


Is it possible to get the filename of a phtml file that's been assign to Zend_View?

For instance,

i've got this on my controller

$this->view = new Zend_View();

$this->view->setScriptPath(APPLICATION_PATH . "/views/scripts/"); $this->view->render('email/xxx.phtml');

the question is,

how do I get 'email/xxx.phtml' from the object?


Solution

  • you can use the ViewRenderer Helper, from your controller:

    $viewRenderer = $this->_helper->viewRenderer;
    $viewScript = $viewRenderer->getViewScript();
    

    take a look at http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelper.viewrenderer.basicusage