I had set up a layout structure with one layout inside another for
simplicity, but it's turning out to be more complex.  I would appreciate
help in getting the following to work:

The following is a simplified, but accurate representation of what I'm
doing:

controllers
-->IndexController.php
-->WidgetController.php
-->Widget2Controller.php
views
-->layouts
------>mainlayout.phtml
------>sublayout.phtml
-->widget
------>list.phtml
-->widget2
------>list.phtml

When the index controller is called, the idea is that the rendered content
of views/widget/list.phtml and views/widget2/list.phtml will be included
inside views/layouts/sublayout.phtml which will be included inside
views/layouts/mainlayout.phtml  -- This will enable me to have multiple
sublayouts inside mainlayout, or to switch sublayouts based on the context
of the situation.

The way I am trying to handle this in indexController/indexAction:
$this->_helper->actionStack('render');  //renderAction renders
sublayout.phtml
$this->_helper->actionStack('list', 'widget');
$this->_helper->actionStack('list', 'widget2');

sublayout.phtml contains:
$this->layout()->setLayout('mainlayout');
echo $this->layout()->widgetlist;
echo $this->layout()->widgetlist2;

sublayout.phtml is correctly incorporated into mainlayout, but
layout()->widgetlist and widget2 remain empty to sublayout.phtml, even
though their actions render first.  'echo $this->layout()->widgetlist'
however works in mainlayout.phtml

What is the correct way to go about this?

Reply via email to