2

extbaseコントローラーで流体パーシャルを使用してajaxリクエスト/レスポンスに再利用する方法の例が見つかりませんでした。

タグf:render partial = ""に似ていますが、コントローラーでjson応答でhtmlを返します。

4

1 に答える 1

1

私は解決策を見つけました:

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

しかし、唯一の問題は、setRenderingContextメソッドがデフォルトのRenderingContextを正しく設定していないことです。メソッドを変更する必要があります。

于 2011-06-16T22:20:02.310 に答える