开发者

Reuse of Extbase Partials for Ajax

开发者 https://www.devze.com 2023-03-13 04:52 出处:网络
I didn\'t find a Example how to use a fluid partial in a extbase controller to reu开发者_运维问答se it for an ajax request/response.

I didn't find a Example how to use a fluid partial in a extbase controller to reu开发者_运维问答se it for an ajax request/response.

Something like the Tag f:render partial="" but in a controller to return the html in a json response.


I found a solution:

$this->templateView = $this->objectManager->create('Tx_Fluid_View_TemplateView');
$res = t3lib_extMgm::extPath($this->controllerContext->getRequest()->getControllerExtensionKey()) . 'Resources/Private/';
$this->templateView->setLayoutRootPath($res);
$this->templateView->setPartialRootPath($res . 'Partials/');
$this->templateView->setRenderingContext($this->objectManager->create('Tx_Fluid_Core_Rendering_RenderingContext'));
$this->templateView->setControllerContext($this->controllerContext);

$partial = $this->templateView->renderPartial($partialName, Null, $data);

But the only Problem is the setRenderingContext method doesn't set the default RenderingContext correct, i must modify the method.

0

精彩评论

暂无评论...
验证码 换一张
取 消