Zend_Layout的Zend Framework问题

时间:2022-10-10 12:19:47

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?

如何创建类似的东西:$ this-> layout() - > sidebar,我正在尝试大约4个小时......但它对我不起作用!你能举个例子吗?

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');

#2


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

在你的控制器中使用setResponseSegment('sidebar')来使$ this-> layout() - >侧边栏工作......

#3


You could use this:

你可以用这个:

In your controller:

在你的控制器中:

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

In your layout:

在你的布局中:

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

#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');

#2


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

在你的控制器中使用setResponseSegment('sidebar')来使$ this-> layout() - >侧边栏工作......

#3


You could use this:

你可以用这个:

In your controller:

在你的控制器中:

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

In your layout:

在你的布局中:

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