【问题标题】:Reuse of Extbase Partials for Ajax为 Ajax 重用 Extbase Partials
【发布时间】:2011-06-16 10:22:30
【问题描述】:

我没有找到如何在 extbase 控制器中使用流体部分以将其重用于 ajax 请求/响应的示例。

类似于标签 f:render partial="" 但在控制器中以 json 响应返回 html。

【问题讨论】:

    标签: php ajax typo3 fluid extbase


    【解决方案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,我必须修改方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-25
      • 2018-01-11
      相关资源
      最近更新 更多