views:

283

answers:

4

How can I create something like: $this->layout()->sidebar, I'm trying for about 4 hours...but it doesn't work for me!Can you give me an example?

+1  A: 

I'm still not certain what you are trying to do - but maybe this code that I'm using would help.

// setup the info column into the placeholder
$this->placeholder('rightcol')
     ->set($this->render('index/view_infoCol.phtml'));

// later in the layout template
echo $this->placeholder('rightcol');
Alister Bulman
A: 

The sidebar is probably something which stays the same more or less while the content changes. In that case I would use a partial and set it up as a separate response segment in your actionSetup.

tharkun
A: 

use setResponseSegment('sidebar') in you controller to make $this->layout()->sidebar work...

Tomáš Fejfar
A: 

You could use this:

In your controller:

$this->_response->insert('sidebar', $this->view->render('sidebar.phtml'));

In your layout:

<?=$this->layout()->sidebar;?>
eckberg