Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple layouts for different modules - Zend Framework

I have a question about layouts in Zend Framework. This is my structure of my project:

  • I have 2 modules named "backoffice" and "frontoffice".
  • I have one layout.phtml in layouts/scripts for both the backoffice and frontoffice.
  • Now I want seperate "layouts/scripts" for "backoffice" and "frontoffice"
  • In my application.ini I have: resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

Now how can I fix this that I have seperate layouts?

like image 201
nielsv Avatar asked Jan 17 '13 16:01

nielsv


1 Answers

Just place another layout in the layout/scripts folder and tell any module, controller or action to use that other layout instead of the default layout.

If you want to let a controller use a different layout, you can place the following in your init()

$this->_helper->layout->setLayout('layoutname');

You can do that respectively for specific actions or for a whole module.

like image 130
markus Avatar answered Sep 21 '22 05:09

markus