我有一个ajax app,其中链接调用ajax的动作,可以改变3个部分的布局。
$data = new stdClass();
$data->header = $this->ajaxView->render('header.phtml');
$data->footer = $this->ajaxView->render('footer.phtml');
$data->content = $this->ajaxView->render('content.phtml');
echo Zend_Json::encode($data);
这很好,但我有时需要更改一些部分。理想情况下,我想用diffirent标头和主html更改整个布局。通常我可以这样做:
$this->_helper->layout->setLayout('different-layout');
但它在ajax中不起作用。使用ajax可以做到这一点吗?