0

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?

3
  • Your purpose is not clear. What is your final target? Commented Jul 15, 2009 at 19:03
  • i want to create a layout helper, sa when i write $this->layout()->sidebar, toretrive some html..like $this->layout()->content, how can i to that?what i need to do?i hope you got it now :) Commented Jul 15, 2009 at 19:25
  • Create a view helper and use it normally in your layout code/view code. Commented Jul 15, 2009 at 21:20

3 Answers 3

1

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');
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

0

You could use this:

In your controller:

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

In your layout:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.