In Zend Framework we can change the file extension of view files from phtml to php by adding following code to controller.
$this->getHelper('viewRenderer')->setViewSuffix('php');
But how to change the file extension for layout files?
In Zend Framework we can change the file extension of view files from phtml to php by adding following code to controller.
$this->getHelper('viewRenderer')->setViewSuffix('php');
But how to change the file extension for layout files?
Untested, but likely through
Zend_Layout::setViewSuffix()
- Set layout view script suffix andZend_Layout_Controller_Action_Helper_Layout::getLayoutInstance()
Try
$this->getHelper('layout')->getLayoutInstance()->setViewSuffix('php');
You can also try
Zend_Layout::getMvcInstance()->setViewSuffix('php');
There is also Zend_Application_Resource_Layout
, so you can likely setup the viewSuffix
from your application.ini as well when using Zend_Application
, e.g. something like
resources.layout.viewSuffix = php;