2010-09-30 48 views
1

在Zend Framework中,我们可以通过向控制器添加以下代码将视图文件的文件扩展名从phtml更改为php。Zend Framework布局的文件扩展

$this->getHelper('viewRenderer')->setViewSuffix('php'); 

但是如何更改布局文件的文件扩展名?

回答

2

未经检验的,但有可能通过

尝试

$this->getHelper('layout')->getLayoutInstance()->setViewSuffix('php'); 

你也可以试试

Zend_Layout::getMvcInstance()->setViewSuffix('php'); 

还有Zend_Application_Resource_Layout,所以你可以很可能安装了viewSuffix从你的application.ini以及使用Zend_Application时,例如像

resources.layout.viewSuffix = php; 
+0

谢谢,$ this-> getHelper('layout') - > setViewSuffix('php');它为我工作。 – 2010-09-30 12:30:08