简体   繁体   中英

using ZEND_Layout, having different Layouts

I asked a similar question again, but I don´t get it. I wanted to try using different layouts at first just for understanding ZEND_Layout.

I have two layout files in my layout path: application\\layouts\\scripts layout.phtml login.phtml

First I want to use login.phtml, because of that I defined it in my application.ini, here is a snippet:

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.layout.layout = "login"

This of course works, I get the layout I wanted. After leaving the page, I want to change the layout (before I read the tutorial): [ http://framework.zend.com/manual/1.12/de/learning.layout.usage.html][1] So I put the following line in my Controller indexAction:

$layout->setLayout('layout');

I just get an error message, "undefined Variable $layout ..."

It must be quite simple, but it doesn´t work, where is the error? I´m missing some basic information I think.

You actually need the $layout variable set.

If you are doing it from your controller, the quickest way.. is to just use..

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM