Problems with layout in Zend

5

I have a view that is formed by a layout different from the default one in my project, so it looks like this:

public function init() {
    //Colocando o layout default
    $this->_helper->layout->setLayout('layout_paginas');
}

But the content of this layout is simply ignored, only the content of the view is loaded, does anyone know what might be happening?

I'm editing here by the following: All actions on this controller work normally, only a specific one does not load the contents of the layout.     

asked by anonymous 17.12.2013 / 20:16

2 answers

2

Try this:

// Usar o layout layout_paginas.phtml como padrão
Zend_Layout::getMvcInstance()->setLayout('layout_paginas');

Otherwise, use the same way you did, however, informing the layout relative path:

// Neste caso, o diretório padrão é esse: application/layouts/scripts/
$this->_helper->layout->setLayout('application/layouts/scripts/layout_paginas.phtml');
    
17.12.2013 / 20:54
3

For the content of your question I do not know if you are taking the path to the layout into account:

 $layout->setLayoutPath('caminho/para/o/layout');

But you can also change your code to:

$this->_helper->layout->setLayout('/caminho/para/o/layout/layout_paginas');

Notes:
The path to the file is relative to the layouts folder, which by default is located at application/layouts/scripts/ .

If you are using:

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

Actually, you are saying to look for the layout in:

application/layouts/scripts/layout_paginas.phtml

Help:

17.12.2013 / 20:51