I want to define the which Layout the Zend_Layout should use from Bootstrap class. How to do this?
Like from the controller you can do something like
$this->_helper->_layout = "somelayout";
I want to change the layout from the bootstrap class.
I want to define the which Layout the Zend_Layout should use from Bootstrap class. How to do this?
Like from the controller you can do something like
$this->_helper->_layout = "somelayout";
I want to change the layout from the bootstrap class.
You could do it as follows:
public function _initLayout() {
$layout = $this->bootstrap('layout')->getResource('layout');
$layout->setLayout('somelayout');
}
You can look further into it on these pages :
http://framework.zend.com/manual/en/zend.layout.quickstart.html
http://framework.zend.com/manual/en/zend.layout.options.html
The second one is more helpful, but make sure that you read "Using Zend_Layout with the Zend Framework MVC" in the first page.
If you want to start the layout strictly from the bootstrap you can do the following.
public function _initMyLayout()
{
$options = array(
'layout' => 'somelayout',
'layoutPath' => '/path/to/layouts',
'contentKey' => 'CONTENT'
};
$layout = Zend_Layout::startMvc($options);
return $layout;
}
The above would be equivalent to you specifying a default script and path in your .ini file.