2012-01-04 139 views
0

我在擴展使用自己的流體渲染器使用自己的流體渲染失敗:TYPO3液體:因爲TYPO3 4.6

/** 
* Makes and returns a fluid template object 
* 
* @return Tx_Fluid_View_TemplateView the fluid template object 
*/ 
protected function makeFluidTemplateObject() { 
    /** @var Tx_Fluid_View_TemplateView $fluidTemplate */ 
    $fluidTemplate = t3lib_div::makeInstance('Tx_Fluid_View_TemplateView'); 

    // Set controller context 
    $controllerContext = $this->buildControllerContext(); 
    $controllerContext->setRequest($this->request); 
    $fluidTemplate->setControllerContext($controllerContext); 

    return $fluidTemplate; 
} 

我用這個$fluidTemplate後分配模板的文件,變量並使其:

/** 
* Gets the mail message 
* 
* @param mixed $registration model to give to template 
* @param string $templatePath path of fluid template 
* 
* @return string The rendered fluid template (HTML or plain text) 
*/ 
public function getMailMessage($registration, $templatePath) { 
    $mailTemplate = t3lib_div::getFileAbsFileName($templatePath); 
    if (!file_exists($mailTemplate)) { 
     throw new Exception('Mail template (' . $mailTemplate . ') not found. '); 
    } 
    $this->fluidTemplate->setTemplatePathAndFilename($mailTemplate); 

    // Assign variables 
    $this->fluidTemplate->assign('registration', $registration); 
    $this->fluidTemplate->assign('settings', $this->settings); 

    return $this->fluidTemplate->render(); 
} 

一切正常,除了->render()電話。自TYPO3 4.6以來,我得到一個沒有任何指定異常的錯誤500。 TYPO3 4.5 LTS工作正常!

我希望有人有一個想法。提前致謝!

回答

1

由於TYPO3 V4.6,你不需要再構建整個控制器上下文。它現在是通過Tx_Fluid_View_StandaloneView(流體1.4.0)

初始化視圖處理:

protected function makeFluidTemplateObject() { 
    $this->fluidTemplate = t3lib_div::makeInstance('Tx_Fluid_View_StandaloneView'); 
    return $this->fluidTemplate; 
} 

功能getMailMessage($registration, $templatePath)保持不變。

+0

就是這樣!非常感謝你 :) – Armin 2012-01-05 08:44:12