$this->view->layout()->setContentKey('') problem!
i set a new contentkey for showing menu in right column of my site.like this:
public function menuAction()
{
$this->view->layout()->setContentKey('menu');
}
this is layout code:
<div class="center_col"><?php echo $this->layout()->content; ?></div>
<div class="right_col"><?php echo $this->layout()->menu; ?></div>
but there is a prob!! after setting menu contentKey every action result showing in right column (content don`t work!)
i have a plugin for menu action , i think it is that reasone!
this is my plugin:
class Places_Controller_Plugin_ActionSetup extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopStartup( Zend_Controller_Request_Abstract $request)
{
$front = Zend_Controller_Front::getInstance();
if (!$front->hasPlugin('Zend_Controller_Plugin_ActionStack')) {
$actionStack = new Zend_Controller_Plugin_ActionStack();
$front->registerPlugin($actionStack, 97);
} else {
$actionStack = $front->getPlugin('Zend_Controller_Plugin_ActionStack');
}
$menuAction = clone($request);
$menuAction->setActionName('menu')->setControllerName('index');
$actionStack->pushStack($menuAction);
}}
i nead menu action call in all pages , so i use of this plugin!
is there any way for solve my prob?!
answer with 开发者_运维知识库Marcin and SMka help :
public function menuAction()
{
$this->view->placeholder("menu")
->append($this->view->render("menu/menu.phtml" ));
}
in your Menu action just do render to named segment
// Renders my/login.phtml to the 'form' segment of the
// response object
$this->render('login', 'form');
no need layout()->setContentKey
, this method is for other things
精彩评论